/* =====================================================================
   BIXA - Foglio di stile unico
   Brand Cremacom #722e48. Mobile first: la stessa pagina funziona su
   telefono (navigazione in basso) e su desktop (colonna a sinistra).
   ===================================================================== */

:root {
  --bx-primario: #722e48;
  --bx-primario-hover: #5d2338;
  --bx-primario-chiaro: #fbeaf0;
  --bx-primario-bordo: #e7cdd7;

  --bx-bg: #f7f8fa;
  --bx-surface: #ffffff;
  --bx-surface-2: #f3f4f6;
  --bx-bordo: #e5e7eb;
  --bx-testo: #111827;
  --bx-testo-soft: #6b7280;

  --bx-ok: #16a34a;
  --bx-attesa: #d97706;
  --bx-errore: #dc2626;
  --bx-info: #2563eb;

  --bx-nav: 72px;         /* colonna di sinistra su desktop */
  --bx-nav-mobile: 62px;  /* barra in basso su telefono */
  --bx-topbar: 62px;
  --bx-raggio: 12px;
  --bx-ombra: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1);
  --bx-ombra-alta: 0 10px 30px rgba(16,24,40,.12);
  --bx-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="light"]) {
    --bx-bg: #0a1014;
    --bx-surface: #111b21;
    --bx-surface-2: #1b262d;
    --bx-bordo: #24333c;
    --bx-testo: #e9edef;
    --bx-testo-soft: #8696a0;
    --bx-primario-chiaro: #2a1a22;
    --bx-primario-bordo: #4a2a37;
    --bx-ombra: 0 1px 2px rgba(0,0,0,.4);
    --bx-ombra-alta: 0 10px 30px rgba(0,0,0,.5);
  }
}
:root[data-tema="dark"] {
  --bx-bg: #0a1014;
  --bx-surface: #111b21;
  --bx-surface-2: #1b262d;
  --bx-bordo: #24333c;
  --bx-testo: #e9edef;
  --bx-testo-soft: #8696a0;
  --bx-primario-chiaro: #2a1a22;
  --bx-primario-bordo: #4a2a37;
}

* { box-sizing: border-box; }

/* Le regole display:flex/grid dei componenti vincono sull'attributo hidden:
   senza questa riga i badge a zero e i blocchi nascosti restano a schermo. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bx-bg);
  color: var(--bx-testo);
  font-family: var(--bx-font);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--bx-primario); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ------------------------------------------------------------ Struttura */
.bx-layout { display: flex; min-height: 100vh; min-height: 100dvh; }

.bx-main {
  flex: 1;
  min-width: 0;                 /* senza questo i figli in griglia sfondano */
  display: flex;
  flex-direction: column;
}

.bx-content {
  flex: 1;
  padding: 20px;
  min-width: 0;
}
.bx-content-largo { padding: 0; display: flex; min-height: 0; }

/* ----------------------------------------------------------- Navigazione */
.bx-nav {
  width: var(--bx-nav);
  background: var(--bx-primario);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
}

.bx-nav-brand {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,.14);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 20px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.bx-nav-brand-mark { line-height: 1; }

.bx-nav-items {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  flex: 1;
  scrollbar-width: none;
}
.bx-nav-items::-webkit-scrollbar { display: none; }

.bx-nav-bottom {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%; padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,.15);
}

.bx-nav-item {
  position: relative;
  width: 56px; height: 56px;
  flex: 0 0 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 16px;
  color: rgba(255,255,255,.82);
  transition: background .18s, color .18s;
}
.bx-nav-item:hover { background: rgba(255,255,255,.16); color: #fff; }
.bx-nav-item.active { background: #fff; color: var(--bx-primario); }
.bx-nav-item .material-icons { font-size: 23px; line-height: 1; }
.bx-nav-label { font-size: 10px; margin-top: 3px; line-height: 1; white-space: nowrap; }

.bx-badge {
  position: absolute; top: 4px; right: 6px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px;
  background: var(--bx-errore); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* --------------------------------------------------------------- Topbar */
.bx-topbar {
  position: sticky; top: 0; z-index: 50;
  min-height: var(--bx-topbar);
  background: var(--bx-surface);
  border-bottom: 1px solid var(--bx-bordo);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 16px;
}
.bx-topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bx-topbar-icon {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--bx-primario-chiaro); color: var(--bx-primario);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; flex-shrink: 0;
}
.bx-topbar-title h1 { font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bx-topbar-title p { font-size: 12px; color: var(--bx-testo-soft); margin-top: 2px; }
.bx-topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.bx-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bx-primario); color: #fff;
  border: none; cursor: pointer; padding: 0; overflow: hidden;
  font-size: 13px; font-weight: 700; letter-spacing: .3px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.bx-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.bx-menu-foto {
  width: 42px; height: 42px; border-radius: 50%;
  object-fit: cover; margin-bottom: 6px;
}

/* --------------------------------------------------------- Foto profilo */
.bx-foto {
  position: relative;
  width: 104px; height: 104px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bx-surface-2);
  border: 3px solid var(--bx-surface);
  box-shadow: var(--bx-ombra);
}
.bx-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bx-foto-azione {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 30px;
  background: rgba(17, 24, 39, .62);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  font-size: 12px; font-weight: 600;
}
.bx-foto-azione .material-icons { font-size: 17px; }
.bx-foto.caricamento { opacity: .5; pointer-events: none; }

.bx-foto-riga {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.bx-foto-riga > div { min-width: 0; }

.bx-menu {
  position: absolute; top: calc(var(--bx-topbar) - 4px); right: 12px; z-index: 60;
  min-width: 232px;
  background: var(--bx-surface);
  border: 1px solid var(--bx-bordo);
  border-radius: var(--bx-raggio);
  box-shadow: var(--bx-ombra-alta);
  overflow: hidden;
}
.bx-menu-head { padding: 12px 14px; border-bottom: 1px solid var(--bx-bordo); display: flex; flex-direction: column; gap: 2px; }
.bx-menu-head span { font-size: 12px; color: var(--bx-testo-soft); }
.bx-menu-tenant { color: var(--bx-primario) !important; font-weight: 600; }
.bx-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; color: var(--bx-testo); font-size: 14px;
}
.bx-menu a:hover { background: var(--bx-surface-2); }
.bx-menu a .material-icons { font-size: 19px; color: var(--bx-testo-soft); }
.bx-menu-esci { border-top: 1px solid var(--bx-bordo); color: var(--bx-errore) !important; }
.bx-menu-esci .material-icons { color: var(--bx-errore) !important; }

/* -------------------------------------------------------------- Bottoni */
.bx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid transparent;
  background: var(--bx-primario); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
  transition: background .18s, border-color .18s, color .18s;
}
.bx-btn:hover { background: var(--bx-primario-hover); }
.bx-btn .material-icons { font-size: 19px; }
.bx-btn-secondario { background: var(--bx-surface); color: var(--bx-testo); border-color: var(--bx-bordo); }
.bx-btn-secondario:hover { background: var(--bx-surface-2); }
.bx-btn-pericolo { background: var(--bx-errore); }
.bx-btn-pericolo:hover { background: #b91c1c; }
.bx-btn-piatto { background: transparent; color: var(--bx-testo-soft); }
.bx-btn-piatto:hover { background: var(--bx-surface-2); color: var(--bx-testo); }
.bx-btn:disabled { opacity: .55; cursor: not-allowed; }
.bx-btn-icona { width: 38px; padding: 0; }

/* ---------------------------------------------------------------- Campi */
.bx-campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bx-campo label { font-size: 12px; font-weight: 600; color: var(--bx-testo-soft); }
.bx-input, .bx-select, .bx-textarea {
  width: 100%;
  min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--bx-bordo); border-radius: 10px;
  background: var(--bx-surface); color: var(--bx-testo);
  outline: none;
}
.bx-input:focus, .bx-select:focus, .bx-textarea:focus {
  border-color: var(--bx-primario);
  box-shadow: 0 0 0 3px var(--bx-primario-chiaro);
}
.bx-textarea { min-height: 96px; resize: vertical; }

.bx-form-griglia {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.bx-form-griglia > * { min-width: 0; }   /* altrimenti i campi lunghi sfondano */
.bx-col-2 { grid-column: span 2; }
@media (max-width: 640px) { .bx-col-2 { grid-column: span 1; } }

/* --------------------------------------------------------------- Ricerca */
.bx-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.bx-ricerca {
  position: relative; flex: 1 1 240px; min-width: 0;
}
.bx-ricerca .material-icons {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--bx-testo-soft); font-size: 20px; pointer-events: none;
}
.bx-ricerca input { padding-left: 38px; }

/* ---------------------------------------------------------------- Schede */
.bx-card {
  background: var(--bx-surface);
  border: 1px solid var(--bx-bordo);
  border-radius: var(--bx-raggio);
  box-shadow: var(--bx-ombra);
}
.bx-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--bx-bordo);
}
.bx-card-head h2 { font-size: 15px; }
.bx-card-body { padding: 16px; }

.bx-griglia {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.bx-griglia > * { min-width: 0; }

/* --------------------------------------------------------------- Tabelle */
.bx-tabella-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bx-tabella { width: 100%; border-collapse: collapse; font-size: 14px; }
.bx-tabella th, .bx-tabella td {
  padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--bx-bordo);
  white-space: nowrap;
}
.bx-tabella th { font-size: 12px; color: var(--bx-testo-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.bx-tabella tbody tr:hover { background: var(--bx-surface-2); cursor: pointer; }
.bx-tabella td.bx-td-lungo { white-space: normal; max-width: 420px; }

/* Su telefono la tabella diventa un elenco di schede */
@media (max-width: 760px) {
  .bx-tabella-responsive thead { display: none; }
  .bx-tabella-responsive, .bx-tabella-responsive tbody, .bx-tabella-responsive tr, .bx-tabella-responsive td { display: block; width: 100%; }
  .bx-tabella-responsive tr {
    background: var(--bx-surface);
    border: 1px solid var(--bx-bordo);
    border-radius: var(--bx-raggio);
    margin-bottom: 10px;
    padding: 6px 4px;
  }
  .bx-tabella-responsive td {
    border: none;
    display: flex; justify-content: space-between; gap: 12px;
    padding: 7px 12px; white-space: normal;
  }
  .bx-tabella-responsive td::before {
    content: attr(data-label);
    font-size: 12px; font-weight: 600; color: var(--bx-testo-soft);
    flex: 0 0 38%;
  }
  .bx-tabella-responsive td:empty { display: none; }

  /* La prima colonna fa da intestazione della scheda: niente etichetta e
     niente allineamento a destra, altrimenti il nome finisce in fondo. */
  .bx-tabella-responsive td:first-child {
    display: block;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bx-bordo);
    margin-bottom: 4px;
  }
  .bx-tabella-responsive td:first-child::before { content: none; }
}

/* -------------------------------------------------------------- Etichette */
.bx-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  background: var(--bx-surface-2); color: var(--bx-testo-soft);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.bx-chip-ok      { background: rgba(22,163,74,.12);  color: var(--bx-ok); }
.bx-chip-attesa  { background: rgba(217,119,6,.14);  color: var(--bx-attesa); }
.bx-chip-errore  { background: rgba(220,38,38,.12);  color: var(--bx-errore); }
.bx-chip-info    { background: rgba(37,99,235,.12);  color: var(--bx-info); }
.bx-chip-brand   { background: var(--bx-primario-chiaro); color: var(--bx-primario); }

.bx-pallino { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* --------------------------------------------------------------- Avatar */
.bx-iniziali {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}

/* ---------------------------------------------------------- Stato vuoto */
.bx-vuoto {
  padding: 48px 20px; text-align: center; color: var(--bx-testo-soft);
}
.bx-vuoto .material-icons { font-size: 46px; opacity: .45; }
.bx-vuoto h3 { margin: 12px 0 6px; font-size: 16px; color: var(--bx-testo); }
.bx-vuoto p { font-size: 14px; max-width: 420px; margin: 0 auto 16px; }

/* ------------------------------------------------------------- Modale */
.bx-modale-fondo {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.bx-modale {
  background: var(--bx-surface);
  border-radius: 16px;
  box-shadow: var(--bx-ombra-alta);
  width: 100%; max-width: 620px;
  max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.bx-modale-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--bx-bordo);
}
.bx-modale-head h2 { font-size: 16px; }
.bx-modale-body { padding: 18px; overflow-y: auto; }
.bx-modale-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 13px 18px; border-top: 1px solid var(--bx-bordo);
  background: var(--bx-surface-2);
}
/* Su telefono la modale sale dal basso a tutta larghezza */
@media (max-width: 640px) {
  .bx-modale-fondo { padding: 0; align-items: flex-end; }
  .bx-modale { max-width: none; border-radius: 18px 18px 0 0; max-height: 92dvh; }
  .bx-modale-foot { padding-bottom: calc(13px + env(safe-area-inset-bottom)); }
}

/* --------------------------------------------------------------- Toast */
.bx-toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--bx-nav-mobile) + 16px); z-index: 300;
  max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 10px;
  background: #111827; color: #fff; font-size: 14px;
  box-shadow: var(--bx-ombra-alta);
}
.bx-toast.errore { background: var(--bx-errore); }
.bx-toast.ok { background: var(--bx-ok); }
@media (min-width: 861px) { .bx-toast { bottom: 24px; } }

/* -------------------------------------------- Liste a due pannelli (chat/mail) */
.bx-split { display: flex; width: 100%; min-height: 0; flex: 1; }
.bx-split-lista {
  width: 340px; flex-shrink: 0;
  border-right: 1px solid var(--bx-bordo);
  background: var(--bx-surface);
  display: flex; flex-direction: column; min-height: 0;
}
.bx-split-dettaglio { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bx-bg); }

.bx-lista-voce {
  display: flex; gap: 11px; align-items: center;
  padding: 11px 14px; border-bottom: 1px solid var(--bx-bordo);
  cursor: pointer; min-width: 0;
}
.bx-lista-voce:hover { background: var(--bx-surface-2); }
.bx-lista-voce.attiva { background: var(--bx-primario-chiaro); }
.bx-lista-testi { flex: 1; min-width: 0; }
.bx-lista-titolo {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  font-weight: 600; font-size: 14px;
}
.bx-lista-titolo span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-lista-ora { font-size: 11px; color: var(--bx-testo-soft); flex-shrink: 0; font-weight: 500; }
.bx-lista-anteprima {
  font-size: 13px; color: var(--bx-testo-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px;
}

/* Telefono: si vede un pannello alla volta */
@media (max-width: 860px) {
  .bx-split-lista { width: 100%; border-right: none; }
  .bx-split[data-vista="dettaglio"] .bx-split-lista { display: none; }
  .bx-split[data-vista="lista"] .bx-split-dettaglio { display: none; }
}
@media (min-width: 861px) {
  .bx-torna-lista { display: none !important; }
}

/* ------------------------------------------------------- Bolle messaggi */
.bx-chat-scroll { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bx-bolla {
  max-width: min(78%, 560px);
  padding: 8px 12px; border-radius: 12px;
  background: var(--bx-surface); border: 1px solid var(--bx-bordo);
  font-size: 14px; line-height: 1.45; word-wrap: break-word; white-space: pre-wrap;
}
.bx-bolla-in  { align-self: flex-start; background: var(--bx-surface-2); }
.bx-bolla-out { align-self: flex-end; background: var(--bx-primario-chiaro); border-color: var(--bx-primario-bordo); }
.bx-bolla-meta { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 3px; font-size: 11px; color: var(--bx-testo-soft); }
.bx-bolla-meta .material-icons { font-size: 14px; }
.bx-spunta-letto { color: var(--bx-info); }

.bx-composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--bx-bordo); background: var(--bx-surface);
}
.bx-composer textarea {
  flex: 1; min-height: 40px; max-height: 140px; resize: none;
  padding: 10px 12px; border: 1px solid var(--bx-bordo); border-radius: 20px;
  background: var(--bx-bg); color: var(--bx-testo); outline: none;
}

/* ------------------------------------------------------------ Statistiche */
.bx-kpi {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px;
  margin-bottom: 18px;
}
.bx-kpi > * { min-width: 0; }
.bx-kpi-tile {
  background: var(--bx-surface); border: 1px solid var(--bx-bordo);
  border-radius: var(--bx-raggio); padding: 14px 16px; box-shadow: var(--bx-ombra);
}
.bx-kpi-etichetta { font-size: 12px; color: var(--bx-testo-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.bx-kpi-valore { font-size: 26px; font-weight: 700; margin-top: 6px; line-height: 1.1; }
.bx-kpi-nota { font-size: 12px; color: var(--bx-testo-soft); margin-top: 4px; }

/* ------------------------------------------------------- Interruttori */
.bx-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.bx-switch input { opacity: 0; width: 0; height: 0; }
.bx-switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 26px; transition: background .2s;
}
.bx-switch-slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.bx-switch input:checked + .bx-switch-slider { background: var(--bx-primario); }
.bx-switch input:checked + .bx-switch-slider::before { transform: translateX(20px); }
.bx-switch input:focus-visible + .bx-switch-slider { box-shadow: 0 0 0 3px var(--bx-primario-chiaro); }

/* ============================================================== MOBILE */
@media (max-width: 860px) {
  .bx-layout { flex-direction: column; }

  /* La navigazione scende in basso, con scorrimento orizzontale */
  .bx-nav {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    width: 100%; height: calc(var(--bx-nav-mobile) + env(safe-area-inset-bottom));
    flex-direction: row; align-items: center;
    padding: 0 4px env(safe-area-inset-bottom);
    z-index: 100;
    border-top: 1px solid rgba(0,0,0,.18);
  }
  .bx-nav-brand, .bx-nav-bottom { display: none; }
  .bx-nav-items {
    flex-direction: row; gap: 2px; height: 100%;
    overflow-x: auto; overflow-y: hidden;
    justify-content: flex-start; align-items: center;
  }
  .bx-nav-item { width: 62px; min-width: 62px; height: 52px; flex: 0 0 62px; border-radius: 12px; }
  .bx-nav-item .material-icons { font-size: 21px; }
  .bx-nav-label { font-size: 9px; }

  .bx-main { padding-bottom: calc(var(--bx-nav-mobile) + env(safe-area-inset-bottom)); }
  .bx-content { padding: 14px; }
  .bx-topbar { padding: 8px 12px; }
  .bx-topbar-title h1 { font-size: 16px; }
  .bx-menu { right: 8px; left: 8px; min-width: 0; }

  /* Le azioni della topbar restano, ma senza testo quando sono tante */
  .bx-topbar-actions .bx-btn-testo { display: none; }
}

/* Schermi molto stretti */
@media (max-width: 380px) {
  .bx-nav-item { width: 56px; min-width: 56px; flex-basis: 56px; }
  .bx-kpi { grid-template-columns: 1fr 1fr; }
}

/* Tocco: niente hover appiccicoso, aree cliccabili da 44px */
@media (hover: none) {
  .bx-tabella tbody tr:hover { background: transparent; }
  .bx-btn, .bx-nav-item, .bx-lista-voce { -webkit-tap-highlight-color: transparent; }
}

.bx-solo-desktop { }
@media (max-width: 860px) { .bx-solo-desktop { display: none !important; } }
.bx-solo-mobile { display: none !important; }
@media (max-width: 860px) { .bx-solo-mobile { display: flex !important; } }

/* Stampa: via navigazione e pulsanti */
@media print {
  .bx-nav, .bx-topbar-actions, .bx-btn { display: none !important; }
  .bx-main { padding: 0; }
}

/* Foto piccola negli elenchi (utenti, assegnazioni) */
.bx-foto-piccola {
  width: 30px; height: 30px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  background: var(--bx-surface-2);
}
