/*
  FX Hub — KIT design system FX (docs/v2.3/20).
  Riferimento visivo: docs/integration/hub-ui/hub-app-users-mockup.html + hub-app-ui-guidelines.html.

  SORGENTE DI VERITÀ UNICA E GLOBALE dei componenti .fx-* (card, toolbar, campi,
  bottoni, tabella, badge, paginazione, modali, definition-list, form). Usato sia
  dalla shell (login, topbar, dashboard) sia dai moduli nativi / Hub App: una sola
  definizione per componente, un solo set di token (in base.css :root).

  Le classi NON sono più scopate sotto `.fx-module`: valgono ovunque. `.fx-module`
  resta solo come CONTENITORE di pagina del modulo (max-width + centratura).

  Font: Bricolage Grotesque (display) + Hanken Grotesk (body), self-hosted da
  internal/webassets (var --font-display/--font-body in base.css). Nessun CDN.
*/

/* =========================================================================
   CONTENITORE DI PAGINA DEL MODULO
   ========================================================================= */
.fx-module {
  /* Cap di larghezza MANTENUTO (leggibilità righe tabella), ma ancorato a
     SINISTRA (margin-left:0, non auto): lo spazio extra va a destra, coerente
     con la griglia card. Niente più contenuto centrato sul desktop. */
  max-width: 1040px;
  margin: 0;
  /* padding-top = 0: lo stacco topbar↔contenuto è UNIFORME e viene dal solo
     .fx-content (var(--gap)=20px), uguale a dashboard/settings. Niente doppio
     inset (prima .fx-module aggiungeva --sp-6=32px → tabelle a 52px vs 20px).
     Orizzontale/inferiore invariati (bottom per footer/pager visibile). */
  padding: 0 var(--sp-5) var(--sp-6);
}

/* Modulo-tabella full-height: colonna flex alta quanto l'area sotto la topbar
   (.fx-content è bounded — shell.css). header/toolbar/footer naturali; la
   .fx-table-wrap (flex:1 + min-height:0) prende il residuo → altezza tabella
   calcolata dal layout, UGUALE per tutti i moduli, niente offset hardcoded né
   scroll di pagina. Il margine inferiore ~32px = padding-bottom del modulo (--sp-6),
   simmetrico al padding-top: il footer/pager resta DENTRO l'area visibile.
   La catena flex passa per .fx-card e per il box-lista ([id$="-list"], es.
   fx-users-list / fx-al-list / fx-plans-list). */
/* Anello mancante della catena: il server avvolge il frammento nativo in
   <div class="fxapp-hub"> (proxy.go writeWrapped, §10.4 namespacing) — sta TRA
   .fx-content e .fx-module, e senza altezza spezzava la propagazione height:100%.
   Propaga l'altezza SOLO quando avvolge un modulo full-height (:has): le pagine
   native NON-tabella (dashboard, impostazioni: stesso .fxapp-hub ma senza
   .fx-module--fill) restano ad altezza naturale → nessuna regressione. */
.fxapp-hub:has(> .fx-module--fill) { height: 100%; min-height: 0; }
.fx-module--fill { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.fx-module--fill > .fx-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.fx-module--fill > .fx-card > [id$="-list"] { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* Sottotitolo/descrizione di pagina del modulo. NESSUN <h1>: il titolo è SOLO
   nella topbar (#fx-page-title). Qui vive al più un <p> descrittivo (neutro). */
.fx-page-header { margin-bottom: var(--sp-5); }
.fx-page-header p { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

/* =========================================================================
   CARD
   ========================================================================= */
.fx-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: 0;                 /* le sezioni interne gestiscono la propria spaziatura */
}
.fx-card__pad { padding: var(--sp-5); }

/* =========================================================================
   TOOLBAR
   ========================================================================= */
.fx-toolbar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.fx-spacer { flex: 1; }

/* =========================================================================
   CAMPI (input / select)
   ========================================================================= */
.fx-field { display: flex; flex-direction: column; gap: 6px; }
.fx-field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.fx-field > .fx-input,
.fx-field > .fx-select { width: 100%; }
/* Righe form/dettaglio multi-campo: i campi affiancati si dividono lo spazio e
   impilano su mobile (flex-wrap). Usate dal form prezzo e dal dettaglio piano. */
.fx-form-row { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: flex-start; }
.fx-form-row > .fx-field { flex: 1 1 160px; min-width: 0; }
.fx-form-row + .fx-form-row { margin-top: var(--sp-3); }
/* Valore read-only dentro un .fx-field (dettaglio piano, ciclo in modifica). */
.fx-field-value { font-size: 14px; color: var(--text); min-height: 22px; display: flex; align-items: center; }
/* Importo con prefisso valuta sulla STESSA riga: "$" + input affiancati, no a-capo. */
.fx-input-money { display: inline-flex; align-items: center; gap: 6px; width: 100%; }
.fx-input-money > .fx-input-prefix { color: var(--text-muted); font-weight: 600; flex: 0 0 auto; }
.fx-input-money > .fx-input { flex: 1 1 auto; width: auto; min-width: 0; }
.fx-input,
.fx-select {
  height: 38px; padding: 0 var(--sp-3); font-family: var(--font-body); font-size: 14px;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.fx-input::placeholder { color: var(--text-subtle); }
.fx-input:focus,
.fx-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}
.fx-input--search { width: 280px; max-width: 100%; }
.fx-select {
  appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235C6470' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* =========================================================================
   BARRA FILTRI (pattern riusabile per le card: estende .fx-toolbar)
   ========================================================================= */
/* Tutti i controlli del filtro hanno la stessa altezza dell'input del kit
   (input/select = 38px; .fx-datefield = 38px), baseline allineata da
   .fx-toolbar (align-items:center). Il bottone d'azione ("Filtra") sta SEMPRE a
   destra: margin-left:auto lo spinge a fine riga, e — grazie a flex-wrap — resta
   allineato a destra anche quando finisce su una riga propria. */
.fx-filterbar > .fx-btn { margin-left: auto; }

/* Datefield con PREFISSO inline ("Da"/"A" a sinistra, niente label sopra): il
   wrapper sembra un unico controllo (bordo+bg+radius sul wrapper), l'input date
   è senza bordo e trasparente. Il picker nativo resta a destra dell'input e NON
   viene clippato (nessun overflow:hidden sul wrapper). */
.fx-datefield {
  display: inline-flex; align-items: center; height: 38px; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); transition: border-color .15s, box-shadow .15s;
}
.fx-datefield:focus-within {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint);
}
.fx-datefield__label {
  padding: 0 var(--sp-2) 0 var(--sp-3); min-width: 1.75rem;
  font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.fx-datefield__input {
  height: 100%; border: none; background: transparent; outline: none; min-width: 0;
  padding: 0 var(--sp-3) 0 0; font-family: var(--font-body); font-size: 14px; color: var(--text);
}

/* =========================================================================
   BOTTONI
   ========================================================================= */
.fx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 var(--sp-4); font-family: var(--font-body);
  font-size: 14px; font-weight: 600; border-radius: var(--r-md);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  background: var(--surface-2); color: var(--text);
}
.fx-btn:active { transform: translateY(1px); }
.fx-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-tint); }
.fx-btn:disabled { opacity: .55; cursor: not-allowed; }
.fx-btn--primary { background: var(--primary); color: #fff; }
.fx-btn--primary:hover { background: var(--primary-hover); }
.fx-btn--secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.fx-btn--secondary:hover { background: var(--surface); border-color: var(--gray-mid); }
.fx-btn--danger { background: var(--surface-2); color: var(--error); border-color: #EBC9C9; }
.fx-btn--danger:hover { background: var(--error-tint); }
.fx-btn--ghost { background: transparent; color: var(--text-muted); }
.fx-btn--ghost:hover { background: var(--surface); color: var(--text); }
.fx-btn--sm { height: 32px; padding: 0 var(--sp-3); font-size: 13px; }
/* --xs è lo STANDARD per i bottoni inline-su-riga (es. dentro una riga di
   dettaglio): più basso di --sm. Eredita da .fx-btn gli stati hover/active/focus
   e si combina con --secondary/--danger. */
.fx-btn--xs { height: 26px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm); }
.fx-btn--block { width: 100%; }   /* full-width: login e form a colonna */

/* =========================================================================
   TABELLA
   ========================================================================= */
.fx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fx-table thead th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-subtle);
  padding: 10px var(--sp-4); border-bottom: 1px solid var(--border);
}
.fx-table tbody td { padding: 14px var(--sp-4); border-bottom: 1px solid var(--border); color: var(--text); }
.fx-table tbody tr:last-child td { border-bottom: none; }
.fx-table tbody tr { transition: background .12s; }
.fx-table tbody tr:hover { background: var(--surface); }
.fx-table .fx-email { font-weight: 600; }
.fx-table .fx-muted { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fx-table .fx-cell-action { text-align: right; }
/* Altezza tabella full-page calcolata dal LAYOUT (flexbox), senza offset hardcoded:
   il modulo-tabella (.fx-module--fill) è una colonna flex alta quanto l'area sotto la
   topbar (.fx-content bounded, vedi shell.css); header/toolbar/footer hanno altezza
   naturale e la .fx-table-wrap prende lo spazio RESIDUO. min-height:0 è essenziale
   perché un flex item scrolli (invece di spingere fuori). Riquadro SEMPRE pieno (3
   record → vuoto sotto) e FISSO (50/100 righe → scroll interno). thead sticky. */
.fx-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.fx-table-wrap thead th { position: sticky; top: 0; z-index: 1; background: var(--bg); }
/* Tabelle full-page a COLONNE FISSE (lista utenti + access-log): larghezze costanti
   via table-layout:fixed + <colgroup>; spacing orizzontale ridotto; troncamento pulito.
   Modifier scoped → le sotto-tabelle del dettaglio (.fx-table semplice) restano invariate. */
.fx-table--fixed { table-layout: fixed; }
.fx-table--fixed thead th, .fx-table--fixed tbody td { padding-left: var(--sp-3); padding-right: var(--sp-3); }
.fx-cell-ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-cell-nowrap { white-space: nowrap; }
.fx-cell-right { text-align: right; }
/* Larghezze colonna (%) per i <col> dei colgroup (no inline-style). */
.fx-col-7{width:7%}.fx-col-8{width:8%}.fx-col-9{width:9%}.fx-col-10{width:10%}.fx-col-11{width:11%}
.fx-col-12{width:12%}.fx-col-13{width:13%}.fx-col-14{width:14%}.fx-col-15{width:15%}.fx-col-16{width:16%}
.fx-col-17{width:17%}.fx-col-18{width:18%}.fx-col-19{width:19%}.fx-col-21{width:21%}.fx-col-22{width:22%}.fx-col-26{width:26%}.fx-col-28{width:28%}
/* Cella azione (es. bottone "Dettaglio"): respiro a destra così non tocca il bordo. */
.fx-table--fixed td.fx-cell-action, .fx-table--fixed th.fx-cell-action { padding-right: var(--sp-5); }
/* Search compatta nella barra filtri (desktop); su mobile resta full-width (media query sotto). */
.fx-filterbar .fx-input--search { width: 220px; }
/* Link di deep-link nelle celle (es. UTENTE in access-log → dettaglio utente):
   eredita il colore primario, sottolineato all'hover. Navigazione SPA via
   data-route (nessun reload). */
.fx-link { color: var(--primary); text-decoration: none; cursor: pointer; }
.fx-link:hover { text-decoration: underline; }
.fx-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-tint); border-radius: var(--r-sm); }

/* =========================================================================
   BADGE (pill di stato — canonica, styleguide §4. La bollina notifiche del
   campanello è .fx-notif-count in shell.css: nome distinto, niente collisione.)
   ========================================================================= */
.fx-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  font-size: 12px; font-weight: 600; border-radius: 999px; line-height: 1;
}
.fx-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.fx-badge--success { background: var(--success-tint); color: var(--success); }
.fx-badge--success::before { background: var(--success); }
.fx-badge--neutral { background: var(--surface); color: var(--text-muted); }
.fx-badge--neutral::before { background: var(--gray-mid); }
.fx-badge--danger { background: var(--error-tint); color: var(--error); }
.fx-badge--danger::before { background: var(--error); }
.fx-badge--info { background: var(--info-tint); color: var(--info); }
.fx-badge--info::before { background: var(--info); }
/* Tipo piano "lifetime": petrolio — distinto da neutral(free)/info(recurring) e
   dalle semantiche success/danger di Stato. */
.fx-badge--lifetime { background: var(--petrol-tint); color: var(--petrol); }
.fx-badge--lifetime::before { background: var(--petrol); }
/* warning (ambra/oro): tipo piano one_time — caldo, ben distinto da info (blu)
   e lifetime (petrolio). Riusa i token gold (contrasto AA su tint). */
.fx-badge--warning { background: var(--gold-tint); color: var(--gold); }
.fx-badge--warning::before { background: var(--gold); }
.fx-badge--role { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.fx-badge--role::before { display: none; }
/* Badge COLORATI per ruolo: pill tint + ICONA UTENTE (R2, non il dot), DISTINTI dalle
   semantiche Stato/Blocco (niente verde/rosso). admin→oro · compliance_officer→blu ·
   member→petrolio. Ruoli sconosciuti: palette stabile per hash (h0..h3). */
.fx-badge--role-admin       { background: var(--gold-tint); color: var(--gold); }
.fx-badge--role-compliance  { background: var(--info-tint); color: var(--info); }
.fx-badge--role-member      { background: var(--petrol-tint); color: var(--petrol); }
.fx-badge--role-h0          { background: var(--petrol-tint); color: var(--petrol); }
.fx-badge--role-h1          { background: var(--yellow-tint); color: var(--gray-dark); }
.fx-badge--role-h2          { background: var(--gray-dark-tint); color: var(--gray-dark); }
.fx-badge--role-h3          { background: var(--gold-tint); color: var(--gold); }
/* R2 — i badge ruolo mostrano un'icona utente al posto del dot; eredita il colore del
   ruolo (currentColor) via mask SVG. Le altre famiglie badge mantengono il pallino. */
.fx-badge--role-icon::before {
  content: ""; width: 12px; height: 12px; border-radius: 0; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M12%2012a5%205%200%20100-10%205%205%200%20000%2010zm0%202c-5%200-9%202.5-9%206v2h18v-2c0-3.5-4-6-9-6z'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M12%2012a5%205%200%20100-10%205%205%200%20000%2010zm0%202c-5%200-9%202.5-9%206v2h18v-2c0-3.5-4-6-9-6z'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
}
/* Badge piccolo INLINE (es. stato "verificata" accanto all'email, senza label). */
.fx-badge--sm { height: 18px; padding: 0 7px; font-size: 11px; gap: 4px; }
.fx-badge--sm::before { width: 5px; height: 5px; }

/* =========================================================================
   CELLA VALORE CON COPY + ICON-BUTTON (dettaglio utente: Email/User ID/Nickname)
   ========================================================================= */
/* dd in flex: testo (+ eventuale badge) a sinistra, icona copy spinta a destra. */
.fx-copyrow { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.fx-copyrow > span { overflow-wrap: anywhere; }
.fx-copyrow .fx-iconbtn { margin-left: auto; }
/* Icon-button neutro (copia negli appunti). */
.fx-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex: 0 0 auto; padding: 0;
  background: transparent; color: var(--text-muted);
  border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer;
}
.fx-iconbtn:hover { background: var(--surface); color: var(--text); }
.fx-iconbtn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-tint); }
/* Testo monospaziato (es. User ID UUID). */
.fx-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
/* Editor inline della riga Ruolo (select + conferma/annulla). */
.fx-rolecell-edit { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

/* =========================================================================
   FOOTER / PAGINAZIONE TABELLA
   ========================================================================= */
.fx-table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px;
}
/* Lato destro del footer: selettore "Righe per pagina" + paginatore. */
.fx-table-footer__actions { display: flex; align-items: center; gap: var(--sp-5); }
.fx-pagesize { display: flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }
.fx-pagesize .fx-select { height: 32px; padding: 0 var(--sp-2); font-size: 13px; }
/* Blocco di dettaglio (sezioni Sessioni/Device sotto i dati utente, M7 SM1b):
   titolo + tabella, reso come <details>/<summary> collassabile (vedi sotto). */
.fx-detail-block { margin-top: var(--sp-5); }
.fx-detail-block__title {
  font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 var(--sp-2);
}

/* Sezione collassabile nativa (<details>/<summary>): zero JS per il toggle.
   Il summary porta titolo + badge conteggio (.fx-count); collassata di default.
   Il marker di default è sostituito da una freccetta che ruota su [open]. */
.fx-detail-block__summary {
  display: flex; align-items: center; gap: var(--sp-2);
  cursor: pointer; user-select: none; list-style: none;
  padding: var(--sp-2) 0;
}
.fx-detail-block__summary::-webkit-details-marker { display: none; }
.fx-detail-block__summary::before {
  content: "\203A"; /* › */
  display: inline-block; font-size: 22px; line-height: 1; width: 16px; text-align: center;
  color: var(--text-muted); transition: transform .15s ease;
}
.fx-detail-block[open] > .fx-detail-block__summary::before { transform: rotate(90deg); }
/* Sezione bloccata (es. "Anagrafica" durante l'edit-in-place): forzata aperta,
   toggle disattivato → niente affordance né cursore di apertura sul summary. */
.fx-detail-block.is-locked > .fx-detail-block__summary { cursor: default; }
.fx-detail-block.is-locked > .fx-detail-block__summary::before { visibility: hidden; }
.fx-detail-block__summary .fx-detail-block__title { margin: 0; }
.fx-detail-block__summary:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--primary-tint); border-radius: var(--r-sm);
}
/* Badge contatore nel summary: pill neutra coerente coi badge di stato. */
.fx-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  font-size: 12px; font-weight: 600; line-height: 1; border-radius: 999px;
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border-strong);
}
/* Riga azioni dentro la sezione collassabile (es. "Revoca tutte"). */
.fx-detail-block__actions {
  display: flex; justify-content: flex-end; margin-bottom: var(--sp-2);
}

/* Azioni compliance (export / legal-hold / retention, M7 SM1c): riga di
   controlli che va a capo su mobile; il campo data resta allineato in basso. */
.fx-compliance-actions {
  display: flex; align-items: flex-end; flex-wrap: wrap;
  gap: var(--sp-3); margin-top: var(--sp-3);
}
.fx-compliance-actions .fx-field { flex: 0 1 auto; }

.fx-pager { display: flex; align-items: center; gap: var(--sp-2); }
.fx-pager button {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  border-radius: var(--r-sm); cursor: pointer; color: var(--text-muted);
}
.fx-pager button:hover:not(:disabled) { border-color: var(--gray-mid); color: var(--text); }
.fx-pager button:disabled { opacity: .4; cursor: default; }

/* =========================================================================
   MODALE (overlay + dialog)
   ========================================================================= */
.fx-overlay {
  position: fixed; inset: 0; background: rgba(22, 24, 29, .45); backdrop-filter: blur(2px);
  display: none; align-items: flex-start; justify-content: center; padding: 48px var(--sp-4);
  z-index: 50; overflow: auto;
}
.fx-overlay.is-open { display: flex; }
.fx-modal {
  width: min(640px, 92vw); max-width: 640px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); animation: fx-pop .16s ease-out;
  /* Colonna flessibile + altezza massima: con più box (Dati personali,
     Sessioni, Device, Compliance) il contenuto cresce → la modale non sborda,
     è il __body a scrollare mentre head/foot restano ancorati. */
  display: flex; flex-direction: column; max-height: min(90vh, calc(100vh - 64px));
}
/* Variante larga: dettaglio piano con tabella Prezzi (5 colonne + azioni). Su
   mobile la media-query .fx-modal{width:100%} più sotto la riporta a tutta larghezza. */
.fx-modal--wide { width: min(980px, 94vw); max-width: 980px; }

/* Tabella Prezzi (sotto-vista dettaglio piano) — stato per VALIDITÀ del prezzo. */
.fx-price-row--expired td { color: var(--text-muted); opacity: .72; }
.fx-price-row--future td { color: var(--text-muted); }
/* Cella sconto su due righe (stato + data). */
.fx-cell-stack { display: flex; flex-direction: column; line-height: 1.25; }
.fx-cell-stack > .fx-cell-sub { font-size: 11px; color: var(--text-muted); }
.fx-cell-note { font-size: 11px; color: var(--text-muted); }
@keyframes fx-pop {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}
.fx-modal__head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
}
.fx-modal__head h2 { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.fx-modal__close {
  width: 32px; height: 32px; display: grid; place-items: center; border: none;
  background: transparent; border-radius: var(--r-sm); cursor: pointer; color: var(--text-muted);
}
.fx-modal__close:hover { background: var(--surface); color: var(--text); }
/* __body scrolla quando il contenuto supera la max-height della modale
   (min-height:0 è necessario perché un flex item scrolli davvero). */
.fx-modal__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--sp-5); }
.fx-modal__foot {
  flex: 0 0 auto;
  display: flex; justify-content: flex-end; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); background: var(--bg);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
/* Bottone del footer allineato a SINISTRA (es. "Chiudi"): spinge le azioni
   successive a destra mantenendo il footer flex-end di default. */
.fx-modal__foot .fx-foot-left { margin-right: auto; }

/* =========================================================================
   DEFINITION LIST (dettaglio) — label | valore spaziati
   ========================================================================= */
.fx-dl { display: grid; grid-template-columns: 128px 1fr; gap: var(--sp-3) var(--sp-4); }
.fx-dl dt { color: var(--text-muted); font-size: 13px; font-weight: 600; padding-top: 1px; }
.fx-dl dd { color: var(--text); font-size: 14px; }
.fx-dl dd.fx-empty,
.fx-empty { color: var(--text-subtle); }
/* Campo editabile in una cella valore (dettaglio in modifica in-place): riempie
   la colonna del valore invece di restare alla larghezza intrinseca. */
.fx-dl dd .fx-input,
.fx-dl dd .fx-select { width: 100%; }
/* Riga di dettaglio con azione inline: valore/badge a sinistra, bottone --xs a
   destra. Usata da Ruolo / Stato / Blocco accesso. */
.fx-dl dd.fx-dd--action { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }

/* =========================================================================
   FORM
   ========================================================================= */
.fx-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.fx-form .fx-field label { color: var(--text); font-size: 13px; }
.fx-form .fx-input,
.fx-form .fx-select { height: 40px; }
.fx-help { font-size: 12px; color: var(--text-subtle); }
.fx-form__error { margin: 0; color: var(--error); font-size: 13px; font-weight: 500; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 640px) {
  .fx-input--search { width: 100%; }
  .fx-toolbar { align-items: stretch; }
  .fx-toolbar .fx-spacer { display: none; }
  .fx-dl { grid-template-columns: 1fr; gap: 2px var(--sp-4); }
  .fx-dl dt { padding-top: var(--sp-2); }
  /* Styleguide §3: su mobile i campi rispettano il target touch (≥44px) e
     font ≥16px (evita anche lo zoom-on-focus iOS). Vale per tutti i form. */
  .fx-input, .fx-select { min-height: 44px; font-size: 16px; }
  /* Barra filtri su mobile: ogni controllo a tutta larghezza e ≥44px; il
     datefield e il suo input seguono (font ≥16px no zoom iOS). "Filtra"
     full-width (margin-left:auto neutralizzato dallo stretch). */
  .fx-filterbar > .fx-input,
  .fx-filterbar > .fx-select,
  .fx-filterbar > .fx-datefield { width: 100%; min-height: 44px; height: 44px; }
  .fx-datefield__input { font-size: 16px; }
  .fx-filterbar > .fx-btn { width: 100%; margin-left: 0; min-height: 44px; font-size: 16px; }
  /* Azioni del modale impilate a tutta larghezza e ≥44px: tap comodo e bottoni
     mai tagliati/coperti (es. dialog di conferma FXHub.confirm). */
  .fx-modal__foot { flex-direction: column-reverse; align-items: stretch; }
  .fx-modal__foot .fx-btn { width: 100%; min-height: 44px; font-size: 16px; }

  /* Overlay con safe-area-inset: la modale non finisce sotto notch/barre su
     mobile. Padding ridotto ma rispettoso degli inset (fallback se non supportati). */
  .fx-overlay {
    padding:
      max(var(--sp-3), env(safe-area-inset-top))
      max(var(--sp-3), env(safe-area-inset-right))
      max(var(--sp-3), env(safe-area-inset-bottom))
      max(var(--sp-3), env(safe-area-inset-left));
  }
  /* La modale riempie la larghezza (meno il padding overlay) e limita l'altezza
     alla viewport dinamica (dvh: tiene conto della barra mobile) → scroll interno. */
  .fx-modal { width: 100%; max-width: none; max-height: min(92dvh, calc(100dvh - 24px)); }
  /* Touch target ≥44px per tutti gli interattivi della modale su mobile. */
  .fx-modal__close { width: 44px; height: 44px; }
  .fx-iconbtn { min-width: 44px; min-height: 44px; }
  .fx-detail-block__summary { min-height: 44px; padding: var(--sp-3) 0; }
  .fx-btn--sm { min-height: 44px; }
  /* Riga role-edit inline: il select prende una riga propria, i bottoni
     (Conferma/Annulla) vanno a capo sotto → nessuna rottura a ~360px. */
  .fx-rolecell-edit .fx-select { flex: 1 1 100%; }

  /* --- Tabelle full-page su mobile (fallback dignitoso, NON card-layout) --- */
  /* Niente layout flex a piena-altezza su mobile (claustrofobico + jank con le barre
     browser): si torna allo SCROLL DI PAGINA naturale. La colonna principale e l'area
     contenuto NON sono più bounded; il modulo-tabella e la sua catena tornano a blocco
     ad altezza naturale; la tabella larga (colonne fisse) ammette lo SCROLL ORIZZONTALE. */
  .fx-main { height: auto; }
  .fx-content { overflow-y: visible; min-height: auto; }
  /* Mobile: stesso principio — padding-top=0, lo stacco viene dal .fx-content
     (uniforme con dashboard/settings anche su mobile). Orizzontale/inferiore ridotti. */
  .fx-module { max-width: none; padding: 0 var(--sp-3) var(--sp-4); }
  /* Stessa specificità del rule desktop (:has) per vincere l'override su mobile. */
  .fxapp-hub:has(> .fx-module--fill) { height: auto; min-height: 0; }
  .fx-module--fill,
  .fx-module--fill > .fx-card,
  .fx-module--fill > .fx-card > [id$="-list"] { display: block; height: auto; min-height: 0; }
  .fx-table-wrap { flex: none; height: auto; max-height: none; overflow-x: auto; }
  /* Footer: conteggio + selettore + pager vanno a capo senza overflow su schermo stretto. */
  .fx-table-footer { flex-wrap: wrap; gap: var(--sp-2); }
  .fx-table-footer__actions { flex-wrap: wrap; gap: var(--sp-3); }
}

/* ============================================================================
   Info-tooltip — componente PUBBLICO FXHub (icona "i" + popup al tap/click).
   Vedi fxhub.js (FXHub.initInfoTooltips / infoTooltip / attributo data-fxhub-info).
   ========================================================================== */
.fxhub-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; padding: 0; margin-left: 6px;
  border: 1px solid var(--border); border-radius: 50%;
  background: transparent; color: var(--text-muted);
  font: italic 700 11px/1 var(--font-body); cursor: pointer;
  vertical-align: middle; flex: 0 0 auto; -webkit-appearance: none; appearance: none;
}
.fxhub-info::before { content: "i"; }
.fxhub-info:hover,
.fxhub-info[aria-expanded="true"] { color: var(--primary); border-color: var(--primary); }
.fxhub-info:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Popup: posizionato via JS (position:fixed + top/left), flip ai bordi del viewport. */
.fxhub-info__pop {
  position: fixed; z-index: 1000; max-width: 260px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text);
  font: 400 12px/1.4 var(--font-body); box-shadow: var(--shadow-lg);
}
