@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap");
/*
 * Stile piatto della shell amministrativa (caricato per ultimo da header.php).
 * - un solo sfondo per sidebar e pagina, separate da una linea sottile
 * - niente box arrotondati annidati: l'unica superficie bianca è il contenuto (tabelle, schede)
 * - sidebar apribile e chiudibile (stato ricordato), a scomparsa su schermi piccoli
 * Solo presentazione: nessuna logica applicativa.
 */
:root {
  --ui-bg: #f6f7f9;
  --ui-surface: #ffffff;
  --ui-line: #e2e6eb;
  --ui-line-soft: #edf0f3;
  --ui-text: #1f2937;
  --ui-muted: #6b7280;
  --ui-hover: #eceff3;
  --ui-accent: #0b5fa5;
  --ui-accent-soft: #e8f1fb;
  --ui-side-w: 252px;
  --ui-radius: 8px;
}
/* Temi: ognuno cambia sfondo e palette.
   Chiaro = grigio neutro e blu; Blu = sfondo azzurrato e blu intenso; Scuro = tutto scuro. */
html[data-shell-theme-boot="light"] { --ui-bg: #f6f7f9; --ui-accent: #0b5fa5; --ui-accent-soft: #e8f1fb; }
html[data-shell-theme-boot="blue"] {
  --ui-bg: #dbe7f6; --ui-line: #c3d4eb; --ui-line-soft: #dde7f4; --ui-hover: #cddcf0;
  --ui-muted: #55657d; --ui-accent: #1d4ed8; --ui-accent-soft: #dbe6fb;
}
html[data-shell-theme-boot="dark"] { --ui-bg: #f3f4f6; --ui-accent: #0b5fa5; --ui-accent-soft: #e5edf7; }

/* ---------- Fondo unico ---------- */
html body[data-shell-theme] {
  background: var(--ui-bg) !important;
  background-image: none !important;
  color: var(--ui-text);
}
html body[data-shell-theme] .container.app-layout-container,
html body[data-shell-theme] .app-layout-container {
  display: grid !important;
  grid-template-columns: var(--ui-side-w) minmax(0, 1fr) !important;
  grid-template-rows: auto 1fr !important;
  column-gap: 0 !important;
  row-gap: 0 !important;
  max-width: none !important;
  width: 100% !important;
  min-height: 100vh;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}
html body[data-shell-theme] .app-shell { display: contents !important; }
html body[data-shell-theme] .app-sidebar { grid-column: 1 !important; grid-row: 1 / span 2 !important; align-self: start !important; }
/* La navigazione secondaria ripeteva le voci della sidebar: non serve più */
html body[data-shell-theme] .app-secondary-nav { display: none !important; }
html body[data-shell-theme] .app-main { grid-column: 2 !important; grid-row: 1 / span 2 !important; width: 100% !important; }

/* ---------- Sidebar ---------- */
html body[data-shell-theme] .app-layout-container .app-sidebar,
html body[data-shell-theme] .app-sidebar {
  display: flex !important;
  flex-direction: column;
  width: auto !important;
  min-width: 0;
  height: 100vh !important;
  max-height: 100vh !important;
  min-height: 0 !important;
  position: sticky !important;
  top: 0;
  margin: 0 !important;
  padding: 14px 12px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  background: var(--ui-bg) !important;
  background-image: none !important;
  border: 0 !important;
  border-right: 1px solid var(--ui-line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--ui-text) !important;
  transform: none !important;
}
html body[data-shell-theme] .app-sidebar .app-sidebar-content { display: flex !important; flex-direction: column; flex: 1; overflow: visible !important; padding: 0 !important; }
html body[data-shell-theme] .app-sidebar .nav-label { display: inline !important; }
html body[data-shell-theme] .app-sidebar-brand {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px !important;
  padding: 0 4px 12px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--ui-line) !important;
  background: transparent !important;
  box-shadow: none !important;
  justify-content: flex-start !important;
}
html body[data-shell-theme] .app-sidebar-brand-logo {
  width: 92px !important; height: 34px !important;
  padding: 0 !important; border: 0 !important; border-radius: 0 !important;
  background: transparent !important; box-shadow: none !important;
}
html body[data-shell-theme] .app-sidebar-brand-copy strong { color: var(--ui-text) !important; font-size: 15px !important; }
html body[data-shell-theme] .app-sidebar-brand-copy span { color: var(--ui-muted) !important; font-size: 11px !important; letter-spacing: 0 !important; text-transform: none !important; }

/* Pulsante chiudi nella sidebar */
html body[data-shell-theme] .app-sidebar > .app-sidebar-toggle {
  display: inline-flex !important;
  position: absolute !important;
  top: 16px; right: 10px;
  width: 30px !important; height: 30px !important; min-height: 0 !important;
  padding: 0 !important; margin: 0 !important;
  align-items: center; justify-content: center;
  border: 1px solid var(--ui-line) !important;
  border-radius: 6px !important;
  background: var(--ui-surface) !important;
  color: var(--ui-muted) !important;
  box-shadow: none !important;
  cursor: pointer;
}
html body[data-shell-theme] .app-sidebar > .app-sidebar-toggle:hover { color: var(--ui-text) !important; background: var(--ui-hover) !important; }
html body[data-shell-theme] .app-sidebar > .app-sidebar-toggle svg { display: none !important; }
html body[data-shell-theme] .app-sidebar > .app-sidebar-toggle::before { content: "«"; font-size: 18px; line-height: 1; }
html body[data-shell-theme] .app-sidebar { position: sticky !important; }
html body[data-shell-theme] .app-sidebar-brand { padding-right: 40px !important; }

/* Utente: testo semplice, niente riquadro */
html body[data-shell-theme] .app-sidebar-utility {
  margin: 0 0 10px !important; padding: 0 4px 12px !important;
  border: 0 !important; border-bottom: 1px solid var(--ui-line) !important; border-radius: 0 !important;
  background: transparent !important; box-shadow: none !important;
}
html body[data-shell-theme] .app-sidebar-user { display: grid; gap: 4px; color: var(--ui-muted) !important; font-size: 12px !important; background: transparent !important; border: 0 !important; padding: 0 !important; }
html body[data-shell-theme] .app-sidebar-user strong { color: var(--ui-text) !important; font-size: 13px !important; }
html body[data-shell-theme] .app-sidebar-user .session-timer {
  background: transparent !important; border: 0 !important; padding: 0 !important; box-shadow: none !important;
  color: var(--ui-muted) !important; font-size: 12px !important; font-weight: 400 !important; margin: 0 !important;
}
html body[data-shell-theme] .app-sidebar-logout {
  justify-self: start; display: inline !important; width: auto !important; min-height: 0 !important;
  margin: 2px 0 0 !important; padding: 0 !important;
  background: transparent !important; border: 0 !important; box-shadow: none !important;
  color: var(--ui-accent) !important; font-size: 12px !important; font-weight: 600 !important; text-decoration: none;
}
html body[data-shell-theme] .app-sidebar-logout:hover { text-decoration: underline; }

/* Voci di menu */
html body[data-shell-theme] .app-sidebar-links { gap: 0 !important; }
html body[data-shell-theme] .app-sidebar-home-link,
html body[data-shell-theme] .app-sidebar-section > .app-sidebar-section-title {
  display: flex !important; align-items: center; gap: 8px;
  min-height: 34px !important; margin: 0 !important; padding: 7px 8px !important;
  border: 0 !important; border-radius: 6px !important;
  background: transparent !important; box-shadow: none !important;
  color: var(--ui-text) !important;
  font-size: 13px !important; font-weight: 600 !important;
  text-transform: none !important; letter-spacing: 0 !important;
  cursor: pointer; list-style: none;
}
html body[data-shell-theme] .app-sidebar-section > .app-sidebar-section-title::-webkit-details-marker { display: none; }
html body[data-shell-theme] .app-sidebar-home-link:hover,
html body[data-shell-theme] .app-sidebar-section > .app-sidebar-section-title:hover { background: var(--ui-hover) !important; }
html body[data-shell-theme] .app-sidebar-home-link.is-active { color: var(--ui-accent) !important; background: var(--ui-accent-soft) !important; }
html body[data-shell-theme] .app-sidebar-section-title::after {
  content: "›" !important; display: block !important; margin-left: auto !important;
  font-size: 16px; line-height: 1; color: var(--ui-muted) !important;
  transform: rotate(0deg); transition: transform .15s ease;
  background: none !important; border: 0 !important; width: auto !important; height: auto !important;
}
html body[data-shell-theme] .app-sidebar-section[open] > .app-sidebar-section-title::after { transform: rotate(90deg); }
html body[data-shell-theme] .app-sidebar-section,
html body[data-shell-theme] .app-sidebar-section.is-active {
  margin: 0 0 2px !important; padding: 0 !important;
  border: 0 !important; border-radius: 0 !important;
  background: transparent !important; box-shadow: none !important;
}
html body[data-shell-theme] .app-sidebar-section-links { display: flex; flex-direction: column; gap: 0 !important; padding: 2px 0 8px 0 !important; margin: 0 !important; }
html body[data-shell-theme] .app-sidebar-section-links .btn,
html body[data-shell-theme] .app-sidebar-links .app-sidebar-section-links .btn {
  display: flex !important; align-items: center; gap: 8px !important;
  justify-content: flex-start !important;
  width: 100% !important; min-height: 30px !important;
  margin: 0 !important; padding: 5px 8px 5px 30px !important;
  border: 0 !important; border-left: 2px solid transparent !important; border-radius: 0 6px 6px 0 !important;
  background: transparent !important; box-shadow: none !important;
  color: var(--ui-muted) !important;
  font-size: 13px !important; font-weight: 500 !important; text-align: left !important;
  transform: none !important;
}
html body[data-shell-theme] .app-sidebar-section-links .btn svg { display: none !important; }
html body[data-shell-theme] .app-sidebar-section-links .btn:hover { background: var(--ui-hover) !important; color: var(--ui-text) !important; }
html body[data-shell-theme] .app-sidebar-section-links .btn.is-active {
  color: var(--ui-accent) !important; font-weight: 600 !important;
  border-left-color: var(--ui-accent) !important; border-radius: 0 !important;
  background: var(--ui-accent-soft) !important;
}
html body[data-shell-theme] .app-sidebar svg { color: var(--ui-muted); stroke: currentColor; }
html body[data-shell-theme] .app-sidebar-section-title svg,
html body[data-shell-theme] .app-sidebar-home-link svg { width: 16px !important; height: 16px !important; flex: none; }

/* Selettore tema in fondo */
html body[data-shell-theme] .app-sidebar-bottom { margin-top: auto !important; padding: 12px 0 0 !important; border-top: 1px solid var(--ui-line); background: transparent !important; }
html body[data-shell-theme] .app-sidebar-theme-switcher { background: transparent !important; border: 0 !important; padding: 0 !important; box-shadow: none !important; gap: 4px !important; justify-content: flex-start !important; }
html body[data-shell-theme] .app-sidebar-theme-btn {
  width: 30px !important; height: 30px !important; min-height: 0 !important; padding: 0 !important;
  border: 1px solid var(--ui-line) !important; border-radius: 6px !important;
  background: var(--ui-surface) !important; color: var(--ui-muted) !important; box-shadow: none !important;
}
html body[data-shell-theme] .app-sidebar-theme-btn.is-active { border-color: var(--ui-accent) !important; color: var(--ui-accent) !important; }

/* ---------- Area contenuti ---------- */
html body[data-shell-theme] .app-main {
  min-width: 0;
  margin: 0 !important;
  padding: 18px 28px 40px !important;
  background: transparent !important;
  border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
}
html body[data-shell-theme] .app-main .app-content-header {
  display: flex !important; align-items: center !important; gap: 12px;
  margin: 0 0 18px !important; padding: 0 0 14px !important;
  min-height: 0 !important;
  background: transparent !important;
  border: 0 !important; border-bottom: 1px solid var(--ui-line) !important;
  border-radius: 0 !important; box-shadow: none !important;
}
html body[data-shell-theme] .app-main .app-content-header .btn { min-height: 34px !important; height: auto !important; padding: 6px 12px !important; }
html body[data-shell-theme] .app-main .app-content-header h1 { margin: 0 !important; font-size: 1.5rem !important; color: var(--ui-text) !important; flex: 1; }

/* I contenitori della pagina non sono più box: restano solo spazio e allineamento */
html body[data-shell-theme] .app-main > div:not(.app-content-header):not(.notification):not(.alert):not([class*="modal"]):not([role="dialog"]),
html body[data-shell-theme] .app-main > section,
html body[data-shell-theme] .app-main > form,
html body[data-shell-theme] .app-main > .container,
html body[data-shell-theme] .app-main > .container > div:not(.notification):not(.alert):not([class*="modal"]) {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Le superfici di contenuto restano bianche, con bordo sottile e angoli appena accennati */
html body[data-shell-theme] .app-main .card,
html body[data-shell-theme] .app-main .card-dashboard,
html body[data-shell-theme] .app-main .dashboard-panel,
html body[data-shell-theme] .app-main .form-container,
html body[data-shell-theme] .app-main .promo-box,
html body[data-shell-theme] .app-main fieldset {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  box-shadow: none !important;
}

/* Tabelle: un'unica superficie, intestazione chiara, righe divise da linee */
html body[data-shell-theme] .app-main .dataTables_wrapper {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  padding: 12px !important;
  box-shadow: none !important;
}
html body[data-shell-theme] .app-main .dataTables_wrapper table.dataTable { border: 0 !important; }
html body[data-shell-theme] .app-main table,
html body[data-shell-theme] .app-main table.dataTable { border-color: var(--ui-line-soft) !important; box-shadow: none !important; }
html body[data-shell-theme] .app-main table thead th,
html body[data-shell-theme] .app-main table.dataTable thead th,
html body[data-shell-theme] .app-main .table thead th,
html body[data-shell-theme] .app-main .table-contabilita thead th {
  background: #f8fafc !important;
  color: var(--ui-muted) !important;
  font-weight: 600 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--ui-line) !important;
  text-shadow: none !important;
}
html body[data-shell-theme] .app-main table tbody tr,
html body[data-shell-theme] .app-main table tbody tr:nth-child(even),
html body[data-shell-theme] .app-main table tbody tr:nth-child(odd),
html body[data-shell-theme] .app-main table.dataTable tbody tr:nth-child(even),
html body[data-shell-theme] .app-main table.dataTable tbody tr:nth-child(odd) { background: var(--ui-surface) !important; }
html body[data-shell-theme] .app-main table tbody td,
html body[data-shell-theme] .app-main table.dataTable tbody td { border: 0 !important; border-bottom: 1px solid var(--ui-line-soft) !important; }
html body[data-shell-theme] .app-main table tbody tr:hover,
html body[data-shell-theme] .app-main table.dataTable tbody tr:hover { background: #f5f8fc !important; }
html body[data-shell-theme] .app-main table.dataTable tbody td.sorting_1,
html body[data-shell-theme] .app-main table.dataTable tbody tr > .sorting_1 { background: transparent !important; box-shadow: none !important; }

/* Pulsanti: uno pieno per l'azione principale, gli altri neutri */
html body[data-shell-theme] .app-main .btn-secondary,
html body[data-shell-theme] .app-main .app-content-header .btn {
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
  border: 1px solid var(--ui-line) !important;
  box-shadow: none !important;
  height: auto !important;
  min-height: 38px !important;
  padding: 8px 14px !important;
}
html body[data-shell-theme] .app-main .btn-secondary:hover,
html body[data-shell-theme] .app-main .app-content-header .btn:hover { background: var(--ui-hover) !important; }

/* ---------- Apri / chiudi sidebar ---------- */
.et-shell-menu-btn {
  display: none;
  align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 10px;
  border: 1px solid var(--ui-line); border-radius: 6px;
  background: var(--ui-surface); color: var(--ui-text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.et-shell-menu-btn:hover { background: var(--ui-hover); }
.et-shell-menu-btn span[aria-hidden] { font-size: 16px; line-height: 1; }
html.et-sidebar-collapsed .et-shell-menu-btn { display: inline-flex; }
html.et-sidebar-collapsed body[data-shell-theme] .container.app-layout-container,
html.et-sidebar-collapsed body[data-shell-theme] .app-layout-container { grid-template-columns: minmax(0, 1fr) !important; }
html.et-sidebar-collapsed body[data-shell-theme] .app-main { grid-column: 1 !important; }
html.et-sidebar-collapsed body[data-shell-theme] .app-layout-container .app-sidebar { display: none !important; }
.et-shell-backdrop { display: none; }

@media (max-width: 1000px) {
  html body[data-shell-theme] .container.app-layout-container,
  html body[data-shell-theme] .app-layout-container { grid-template-columns: minmax(0, 1fr) !important; }
  html body[data-shell-theme] .app-main { grid-column: 1 !important; }
  html body[data-shell-theme] .app-main { padding: 14px 16px 32px !important; }
  /* Su schermi piccoli la sidebar è chiusa e si apre sopra la pagina */
  .et-shell-menu-btn { display: inline-flex; }
  html body[data-shell-theme] .app-layout-container .app-sidebar,
  html.et-sidebar-collapsed body[data-shell-theme] .app-layout-container .app-sidebar {
    display: flex !important;
    position: fixed !important; top: 0; left: 0; bottom: 0; z-index: 10040;
    width: min(300px, 86vw) !important;
    transform: translateX(-102%) !important;
    transition: transform .2s ease;
    box-shadow: 0 10px 40px rgba(15, 23, 42, .18) !important;
  }
  html.et-sidebar-mobile-open body[data-shell-theme] .app-layout-container .app-sidebar { transform: none !important; }
  html.et-sidebar-mobile-open .et-shell-backdrop { display: block; position: fixed; inset: 0; z-index: 10030; background: rgba(15, 23, 42, .35); }
}
@media (prefers-reduced-motion: reduce) {
  html body[data-shell-theme] .app-shell, html body[data-shell-theme] .app-sidebar { transition: none !important; }
}

/* Pulsanti: altezza reale uguale per tutti (alcuni erano content-box e risultavano più alti) */
html body[data-shell-theme] .app-main .btn { box-sizing: border-box !important; }


/* =========================================================
   Carattere: accento di colore, gerarchia e un po' di profondità
   ========================================================= */
:root { --ui-display: "Plus Jakarta Sans", "Roboto", system-ui, sans-serif; --ui-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .05); }

/* Marchio e sidebar */
html body[data-shell-theme] .app-sidebar-brand-copy strong { font-family: var(--ui-display); font-weight: 800 !important; letter-spacing: -.01em; }
html body[data-shell-theme] .app-sidebar-home-link,
html body[data-shell-theme] .app-sidebar-section > .app-sidebar-section-title { font-family: var(--ui-display); }
html body[data-shell-theme] .app-sidebar-section-title svg,
html body[data-shell-theme] .app-sidebar-home-link svg { color: var(--ui-accent) !important; opacity: .85; }
html body[data-shell-theme] .app-sidebar-section[open] > .app-sidebar-section-title,
html body[data-shell-theme] .app-sidebar-section.is-active > .app-sidebar-section-title { color: var(--ui-accent) !important; }
html body[data-shell-theme] .app-sidebar-section-links { margin-left: 15px !important; border-left: 1px solid var(--ui-line); padding-left: 0 !important; }
html body[data-shell-theme] .app-sidebar-section-links .btn,
html body[data-shell-theme] .app-sidebar-links .app-sidebar-section-links .btn { padding-left: 14px !important; border-left: 0 !important; margin-left: 4px !important; border-radius: 6px !important; width: calc(100% - 4px) !important; }
html body[data-shell-theme] .app-sidebar-section-links .btn.is-active {
  background: var(--ui-accent) !important; color: #fff !important; font-weight: 600 !important;
  border-radius: 6px !important; box-shadow: 0 2px 6px color-mix(in srgb, var(--ui-accent) 30%, transparent) !important;
}
html body[data-shell-theme] .app-sidebar-home-link.is-active { background: var(--ui-accent) !important; color: #fff !important; }
html body[data-shell-theme] .app-sidebar-home-link.is-active svg { color: #fff !important; }

/* Titolo pagina con sezione sopra e filo di colore */
html body[data-shell-theme] .app-main .app-content-header { position: relative; border-bottom-color: var(--ui-line) !important; }
html body[data-shell-theme] .app-main .app-content-header::after {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 56px; height: 3px; border-radius: 3px; background: var(--ui-accent);
}
html body[data-shell-theme] .app-main .app-content-header h1 {
  font-family: var(--ui-display) !important; font-weight: 800 !important; letter-spacing: -.02em; font-size: 1.65rem !important;
}
html body[data-shell-theme] .app-main .app-content-header [data-et-kicker] {
  display: block; font-family: var(--ui-display); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ui-accent); margin-bottom: 2px;
}
html body[data-shell-theme] .app-main h2,
html body[data-shell-theme] .app-main h3 { font-family: var(--ui-display); letter-spacing: -.01em; }

/* Superfici: leggera profondità, filo di colore in alto sulle tabelle */
html body[data-shell-theme] .app-main .dataTables_wrapper,
html body[data-shell-theme] .app-main .card,
html body[data-shell-theme] .app-main .card-dashboard,
html body[data-shell-theme] .app-main .dashboard-panel,
html body[data-shell-theme] .app-main .form-container,
html body[data-shell-theme] .app-main .promo-box,
html body[data-shell-theme] .app-main fieldset { box-shadow: var(--ui-shadow) !important; border-radius: 10px !important; }
html body[data-shell-theme] .app-main .dataTables_wrapper { border-top: 3px solid var(--ui-accent) !important; }

/* Intestazione tabelle: tinta d'accento, maiuscoletto */
html body[data-shell-theme] .app-main table thead th,
html body[data-shell-theme] .app-main table.dataTable thead th,
html body[data-shell-theme] .app-main .table thead th,
html body[data-shell-theme] .app-main .table-contabilita thead th {
  background: var(--ui-accent-soft) !important;
  color: color-mix(in srgb, var(--ui-accent) 80%, #000) !important;
  font-size: 11px !important; font-weight: 700 !important; letter-spacing: .04em; text-transform: uppercase;
}
html body[data-shell-theme] .app-main table tbody tr:hover,
html body[data-shell-theme] .app-main table.dataTable tbody tr:hover { background: color-mix(in srgb, var(--ui-accent-soft) 55%, #fff) !important; }

/* Pulsante principale con colore d'accento e rilievo */
html body[data-shell-theme] .app-main .btn:not(.btn-secondary):not(.btn-delete):not(.btn-danger):not(.btn-success):not(.btn-warning):not(.btn-info):not(.btn-sm) {
  box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 2px 8px color-mix(in srgb, var(--ui-accent) 22%, transparent) !important;
}
html body[data-shell-theme] .app-main .btn { transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease; }
html body[data-shell-theme] .app-main .btn:hover { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { html body[data-shell-theme] .app-main .btn:hover { transform: none; } }

/* Campi: focus con colore d'accento */
html body[data-shell-theme] .app-main input:focus,
html body[data-shell-theme] .app-main select:focus,
html body[data-shell-theme] .app-main textarea:focus {
  border-color: var(--ui-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 15%, transparent) !important;
}

/* =========================================================
   Pulsanti: colori espliciti in tutti gli stati (normale, hover, focus)
   così il testo resta sempre leggibile
   ========================================================= */
html body[data-shell-theme] .app-main .btn,
html body[data-shell-theme] .app-main .btn.btn-edit,
html body[data-shell-theme] .app-main .btn.btn-primary {
  --b-bg: var(--ui-accent); --b-fg: #ffffff; --b-bd: var(--ui-accent);
  --b-bg-h: color-mix(in srgb, var(--ui-accent) 82%, #000); --b-fg-h: #ffffff;
}
html body[data-shell-theme] .app-main .btn.btn-info { --b-bg: #2563eb; --b-bd: #2563eb; --b-fg: #fff; --b-bg-h: #1d4ed8; --b-fg-h: #fff; }
html body[data-shell-theme] .app-main .btn.btn-success { --b-bg: #15803d; --b-bd: #15803d; --b-fg: #fff; --b-bg-h: #166534; --b-fg-h: #fff; }
html body[data-shell-theme] .app-main .btn.btn-warning { --b-bg: #f59e0b; --b-bd: #f59e0b; --b-fg: #1f2937; --b-bg-h: #d97706; --b-fg-h: #111827; }
html body[data-shell-theme] .app-main .btn.btn-danger,
html body[data-shell-theme] .app-main .btn.btn-delete { --b-bg: #dc2626; --b-bd: #dc2626; --b-fg: #fff; --b-bg-h: #b91c1c; --b-fg-h: #fff; }
html body[data-shell-theme] .app-main .btn.btn-secondary,
html body[data-shell-theme] .app-main .btn.btn-light,
html body[data-shell-theme] .app-main .app-content-header .btn {
  --b-bg: #ffffff; --b-bd: var(--ui-line); --b-fg: #1f2937; --b-bg-h: #eef2f6; --b-fg-h: #111827;
}
html body[data-shell-theme] .app-main .btn,
html body[data-shell-theme] .app-main .btn:visited {
  background: var(--b-bg) !important;
  color: var(--b-fg) !important;
  border: 1px solid var(--b-bd) !important;
  text-shadow: none !important;
  opacity: 1;
}
html body[data-shell-theme] .app-main .btn:hover,
html body[data-shell-theme] .app-main .btn:focus-visible,
html body[data-shell-theme] .app-main .btn:active {
  background: var(--b-bg-h) !important;
  color: var(--b-fg-h) !important;
  border-color: var(--b-bg-h) !important;
  text-decoration: none !important;
  filter: none !important;
}
html body[data-shell-theme] .app-main .btn.btn-secondary:hover,
html body[data-shell-theme] .app-main .btn.btn-light:hover,
html body[data-shell-theme] .app-main .app-content-header .btn:hover { border-color: #cbd5e1 !important; }
html body[data-shell-theme] .app-main .btn *,
html body[data-shell-theme] .app-main .btn:hover * { color: inherit !important; }
html body[data-shell-theme] .app-main .btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--ui-accent) 45%, transparent); outline-offset: 2px; }
html body[data-shell-theme] .app-main .btn:disabled,
html body[data-shell-theme] .app-main .btn[disabled],
html body[data-shell-theme] .app-main .btn.disabled { opacity: .55 !important; cursor: not-allowed; transform: none !important; }
html body[data-shell-theme] .app-main .btn:disabled:hover,
html body[data-shell-theme] .app-main .btn[disabled]:hover { background: var(--b-bg) !important; color: var(--b-fg) !important; border-color: var(--b-bd) !important; }


/* =========================================================
   Tema scuro: inversione controllata di tutta l'interfaccia.
   Funziona anche sulle pagine con colori scritti direttamente nel codice;
   foto, loghi e video vengono riportati ai colori originali.
   ========================================================= */
html[data-shell-theme-boot="dark"] {
  filter: invert(0.9) hue-rotate(180deg);
  background: #ffffff;
  color-scheme: light;
}
html[data-shell-theme-boot="dark"] img,
html[data-shell-theme-boot="dark"] video,
html[data-shell-theme-boot="dark"] picture,
html[data-shell-theme-boot="dark"] iframe,
html[data-shell-theme-boot="dark"] embed,
html[data-shell-theme-boot="dark"] object,
html[data-shell-theme-boot="dark"] [style*="background-image"],
html[data-shell-theme-boot="dark"] [data-no-invert] {
  filter: invert(1) hue-rotate(180deg);
}
html[data-shell-theme-boot="dark"] .app-main .btn { box-shadow: none !important; }

/* Selettore tema: stato attivo evidente */
html body[data-shell-theme] .app-sidebar-theme-btn { transition: background-color .12s ease, color .12s ease; }
html body[data-shell-theme] .app-sidebar-theme-btn:hover { background: var(--ui-hover) !important; color: var(--ui-text) !important; }
html body[data-shell-theme] .app-sidebar-theme-btn.is-active,
html body[data-shell-theme] .app-sidebar-theme-btn[aria-pressed="true"] {
  background: var(--ui-accent) !important; border-color: var(--ui-accent) !important; color: #fff !important;
}
html body[data-shell-theme] .app-sidebar-theme-btn.is-active svg,
html body[data-shell-theme] .app-sidebar-theme-btn[aria-pressed="true"] svg { color: #fff !important; stroke: currentColor; }


/* =========================================================
   Sidebar su fondo più scuro della pagina (contrasti verificati)
   e selettore del tema sempre visibile in fondo
   ========================================================= */
:root { --ui-side-bg: #e7ebf0; --ui-side-hover: #dbe0e7; --ui-side-text: #1f2937; --ui-side-link: #3f4a5a; }
html[data-shell-theme-boot="blue"] { --ui-side-bg: #c8d9ef; --ui-side-hover: #b8cce8; --ui-side-text: #0f1f3a; --ui-side-link: #233552; }
/* Nel tema scuro i colori vengono invertiti: un fondo più chiaro qui diventa più scuro a schermo */
html[data-shell-theme-boot="dark"] { --ui-side-bg: #ffffff; --ui-side-hover: #eef0f3; --ui-side-text: #1f2937; --ui-side-link: #3f4a5a; }

html body[data-shell-theme] .app-layout-container .app-sidebar,
html body[data-shell-theme] .app-sidebar { background: var(--ui-side-bg) !important; border-right-color: color-mix(in srgb, var(--ui-side-bg) 80%, #000) !important; }
html body[data-shell-theme] .app-sidebar-brand,
html body[data-shell-theme] .app-sidebar-utility { border-bottom-color: color-mix(in srgb, var(--ui-side-bg) 82%, #000) !important; }
html body[data-shell-theme] .app-sidebar-home-link,
html body[data-shell-theme] .app-sidebar-section > .app-sidebar-section-title { color: var(--ui-side-text) !important; }
html body[data-shell-theme] .app-sidebar-section-links .btn,
html body[data-shell-theme] .app-sidebar-links .app-sidebar-section-links .btn { color: var(--ui-side-link) !important; }
html body[data-shell-theme] .app-sidebar-home-link:hover,
html body[data-shell-theme] .app-sidebar-section > .app-sidebar-section-title:hover,
html body[data-shell-theme] .app-sidebar-section-links .btn:hover { background: var(--ui-side-hover) !important; color: var(--ui-side-text) !important; }
html body[data-shell-theme] .app-sidebar-section-links { border-left-color: color-mix(in srgb, var(--ui-side-bg) 78%, #000) !important; }
html body[data-shell-theme] .app-sidebar-user,
html body[data-shell-theme] .app-sidebar-user .session-timer,
html body[data-shell-theme] .app-sidebar-brand-copy span { color: var(--ui-side-link) !important; }
html body[data-shell-theme] .app-sidebar-section-links .btn.is-active,
html body[data-shell-theme] .app-sidebar-home-link.is-active { color: #fff !important; background: var(--ui-accent) !important; }
html body[data-shell-theme] .app-sidebar > .app-sidebar-toggle { background: color-mix(in srgb, var(--ui-side-bg) 60%, #fff) !important; border-color: color-mix(in srgb, var(--ui-side-bg) 80%, #000) !important; color: var(--ui-side-text) !important; }

html body[data-shell-theme] .app-sidebar-bottom {
  position: sticky !important; bottom: -14px; z-index: 2;
  margin: auto -12px -14px !important; padding: 10px 12px 14px !important;
  background: var(--ui-side-bg) !important;
  border-top: 1px solid color-mix(in srgb, var(--ui-side-bg) 82%, #000) !important;
}
html body[data-shell-theme] .app-sidebar-theme-switcher { display: flex !important; justify-content: space-between !important; gap: 6px !important; }
html body[data-shell-theme] .app-sidebar-theme-btn { flex: 1; width: auto !important; height: 32px !important; background: color-mix(in srgb, var(--ui-side-bg) 55%, #fff) !important; border-color: color-mix(in srgb, var(--ui-side-bg) 80%, #000) !important; color: var(--ui-side-text) !important; }
html body[data-shell-theme] .app-sidebar-theme-btn:hover { background: #fff !important; }

/* La sidebar resta agganciata per tutta l'altezza della pagina mentre si scorre:
   overflow:hidden sul contenitore impediva l'aggancio (sticky). "clip" taglia senza bloccarlo. */
html body[data-shell-theme] .container.app-layout-container,
html body[data-shell-theme] .app-layout-container { overflow: visible !important; overflow-x: clip !important; align-items: start !important; }
/* Solo da desktop: su schermi piccoli la sidebar è un pannello che si apre sopra la pagina */
@media (min-width: 1001px) {
  html body[data-shell-theme] .app-layout-container .app-sidebar {
    position: sticky !important; top: 0 !important; align-self: start !important;
    height: 100vh !important; height: 100dvh !important; max-height: 100dvh !important;
  }
}

/* Avvisi senza tipo (es. "Nessuna etichetta…"): testo bianco senza sfondo si perdeva. Stile informativo leggibile in ogni tema. */
html body .notification:not(.success):not(.error):not(.warning):not(.info):not(.danger) {
  background: var(--ui-accent-soft, #e8f1fb) !important;
  color: var(--ui-text, #1f2937) !important;
  border: 1px solid color-mix(in srgb, var(--ui-accent, #0b5fa5) 25%, transparent) !important;
  border-left: 4px solid var(--ui-accent, #0b5fa5) !important;
  font-weight: 600 !important;
}

/* Etichette di stato (Pagata / Da pagare / Scaduta): definite qui per tutte le pagine, anche quelle che non le dichiarano */
.badge.badge-success, .badge.badge-danger, .badge.badge-warning, .badge.badge-info, .badge.badge-secondary {
  display: inline-block; font-weight: 700; font-size: 12px; line-height: 1.3; white-space: nowrap;
}
.badge.badge-success { background-color: #1e7e34; color: #fff; }
.badge.badge-danger { background-color: #c82333; color: #fff; }
.badge.badge-warning { background-color: #ffc107; color: #212529; }
.badge.badge-info { background-color: #117a8b; color: #fff; }
.badge.badge-secondary { background-color: #5a6268; color: #fff; }

/* Il vecchio pulsante flottante del menu si sovrapponeva al pulsante "Menu" della testata */
html body[data-shell-theme] .app-sidebar-floating-toggle { display: none !important; }


/* ---------- Footer sempre in fondo alla pagina ---------- */
.et-site-footer { margin-top: 40px; padding: 18px 0 6px; border-top: 1px solid var(--ui-line, #dee2e6); text-align: center; color: var(--ui-muted, #6c757d); font-size: 12.5px; line-height: 1.6; }
.et-site-footer a { color: inherit; font-weight: 600; text-decoration: underline; }
.et-site-footer-custom { margin-bottom: 6px; font-size: 13px; }
.et-site-footer-note { margin-bottom: 6px; color: var(--ui-text, #4f5d6f); }
.et-site-footer-legal { font-weight: 600; letter-spacing: .01em; }
html body[data-shell-theme] .app-main { display: flex !important; flex-direction: column !important; min-height: 100vh; box-sizing: border-box; }
html body[data-shell-theme] .app-main > .et-footer-spacer, body > .container > .et-footer-spacer { flex: 1 0 40px; }
html body[data-shell-theme] .app-main > .et-site-footer { margin-top: 0 !important; }
body > .container:not(.app-layout-container):not(.et-login-page) { min-height: 100vh; display: flex; flex-direction: column; box-sizing: border-box; }
body > .container:not(.app-layout-container):not(.et-login-page) > .et-site-footer { margin-top: 0; }
/* Login: riquadro al centro, footer in fondo */
html body .container.et-login-page { justify-content: flex-start !important; }
html body .container.et-login-page > .et-login { margin-top: auto !important; margin-bottom: auto !important; }
html body .container.et-login-page > .et-footer-spacer { display: none; }
html body .container.et-login-page > .et-site-footer { width: min(940px, calc(100% - 32px)); margin-top: 24px; border-top: 0; padding-bottom: 14px; }

/* Gruppi Rivenditori / Strutture del menu Contabilità: la regola che mostra i link del menu
   (display:flex !important) non deve impedire di chiudere il gruppo */
html body[data-shell-theme] .app-sidebar-section-links .btn.accounting-group-link.is-collapsed,
html body[data-shell-theme] .app-sidebar-links .btn.accounting-group-link.is-collapsed,
html body[data-shell-theme] .app-secondary-nav .accounting-group-link.is-collapsed { display: none !important; }

/* =========================================================
   Navigazione per flusso (ottobre 2026)
   - icone visibili anche sulle voci: ogni voce ha un disegno proprio
   - intestazioni di fase dentro le sezioni (Acquisisci, Gestisci, …)
   - numerini «da fare» sulle voci e sul titolo della sezione
   ========================================================= */
html body[data-shell-theme] .app-sidebar-section-links .btn svg,
html body[data-shell-theme] .app-sidebar-links .app-sidebar-section-links .btn svg {
  display: block !important; width: 15px !important; height: 15px !important; flex: none;
  color: currentColor !important; opacity: .72;
}
html body[data-shell-theme] .app-sidebar-section-links .btn .nav-icon { width: 15px; height: 15px; flex: 0 0 15px; }
html body[data-shell-theme] .app-sidebar-section-links .btn:hover svg,
html body[data-shell-theme] .app-sidebar-section-links .btn.is-active svg { opacity: 1; }
html body[data-shell-theme] .app-sidebar-section-links .btn .nav-label { flex: 1 1 auto; min-width: 0; }

html body[data-shell-theme] .app-sidebar-phase {
  margin: 9px 0 3px 4px; padding: 0 0 0 14px;
  font: 700 10.5px/1.3 var(--ui-display, inherit); letter-spacing: .06em; text-transform: uppercase;
  color: color-mix(in srgb, var(--ui-side-link, #3f4a5a) 72%, transparent);
  pointer-events: none; user-select: none;
}
html body[data-shell-theme] .app-sidebar-section-links > .app-sidebar-phase:first-child { margin-top: 3px; }

html body[data-shell-theme] .app-sidebar .nav-count {
  display: inline-block !important; flex: none; margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 6px; box-sizing: border-box;
  border-radius: 999px; background: #d97706; color: #fff !important;
  font: 700 11px/18px var(--ui-display, inherit); text-align: center; letter-spacing: 0;
}
html body[data-shell-theme] .app-sidebar-section-links .btn.is-active .nav-count { background: #fff; color: var(--ui-accent) !important; }
html body[data-shell-theme] .app-sidebar-section-title.has-todo .nav-count-section { margin-left: auto; }
html body[data-shell-theme] .app-sidebar-section-title.has-todo::after { margin-left: 8px !important; }
