/* ==========================================================================
   TradImp360 - foglio di stile unico.
   Interfaccia da scrivania: tabelle dense, moduli in pannello laterale,
   niente librerie esterne.
   ========================================================================== */

:root {
  --navy:      #14405e;
  --navy-dark: #0e2f46;
  --navy-soft: #1d5379;
  --accent:    #2b83c4;

  --ink:       #16232c;
  --ink-soft:  #52646f;
  --ink-faint: #8496a1;

  --paper:     #f1f4f6;
  --surface:   #ffffff;
  --surface-2: #e9eef1;
  --rule:      #d6dee3;
  --rule-soft: #e7ecef;

  --ok:        #1c6b47;
  --ok-bg:     #dcefe4;
  --warn:      #8a5a10;
  --warn-bg:   #f8ebd6;
  --bad:       #93292c;
  --bad-bg:    #f7dedd;

  --sidebar-w: 236px;
  --radius: 3px;
  --shadow: 0 1px 2px rgba(16,35,48,.08), 0 4px 12px rgba(16,35,48,.06);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- Accesso ---------- */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
  padding: 1.5rem;
}
.login-box {
  width: 100%; max-width: 360px;
  background: var(--surface);
  border-radius: 6px;
  padding: 2rem 1.75rem;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
  display: flex; flex-direction: column; gap: .5rem;
}
.login-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.login-mark, .brand-mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: var(--navy); color: #fff;
  border-radius: 5px; font-weight: 700; letter-spacing: .02em;
}
.login-brand strong { display: block; font-size: 1.05rem; }
.login-brand small { color: var(--ink-faint); }
.login-box label { font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-top: .5rem; }
.login-error { color: var(--bad); font-size: .85rem; margin: .5rem 0 0; min-height: 1.2em; }

/* ---------- Struttura ---------- */
.app { display: flex; min-height: 100%; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--navy);
  color: rgba(255,255,255,.9);
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-mark { width: 32px; height: 32px; font-size: .85rem; background: var(--accent); }
.brand-text { font-size: 1rem; font-weight: 600; color: #fff; }
.brand-text b { font-weight: 700; color: #8fc9ee; }
.sidebar-close { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }

.nav { flex: 1; overflow-y: auto; padding: .5rem 0 1rem; }
.nav-group { padding: .9rem 1rem .3rem; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.45); }
.nav a {
  display: flex; align-items: center; gap: .55rem;
  padding: .48rem 1rem;
  color: rgba(255,255,255,.85);
  text-decoration: none; font-size: .875rem;
  border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; border-left-color: #8fc9ee; font-weight: 600; }
.nav .badge { margin-left: auto; background: var(--bad); color: #fff; border-radius: 9px; padding: 0 .4rem; font-size: .7rem; }

.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: .75rem 1rem;
  display: flex; align-items: center; gap: .5rem;
}
.who { flex: 1; min-width: 0; }
.who span { display: block; font-size: .85rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: rgba(255,255,255,.55); font-size: .72rem; }
.btn-link { background: none; border: 0; color: #8fc9ee; cursor: pointer; font-size: .82rem; padding: .2rem; }
.btn-link:hover { text-decoration: underline; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  padding: .6rem 1.25rem;
  display: flex; align-items: center; gap: .75rem;
  min-height: 52px;
}
.topbar h1 { font-size: 1.1rem; margin: 0; font-weight: 650; }
.topbar-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.hamburger { display: none; background: none; border: 0; font-size: 1.25rem; cursor: pointer; color: var(--ink); }

.view { padding: 1.25rem; flex: 1; outline: none; }
.backdrop { display: none; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .42rem .85rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  font: inherit; font-size: .86rem;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--navy-soft); }
.btn-danger { color: var(--bad); border-color: #e3bcbb; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: .22rem .5rem; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; margin-top: 1rem; padding: .55rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Schede e griglie ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card-head {
  padding: .7rem 1rem; border-bottom: 1px solid var(--rule-soft);
  display: flex; align-items: center; gap: .6rem;
}
.card-head h2 { margin: 0; font-size: .95rem; font-weight: 650; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 1rem; }

.grid { display: grid; gap: 1rem; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.kpi { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.kpi .kpi-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); }
.kpi .kpi-value { font-size: 1.5rem; font-weight: 650; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.kpi .kpi-note { font-size: .78rem; color: var(--ink-soft); margin-top: .15rem; }
.kpi.is-bad .kpi-value { color: var(--bad); }
.kpi.is-ok .kpi-value { color: var(--ok); }

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.tbl th, table.tbl td { padding: .45rem .6rem; border-bottom: 1px solid var(--rule-soft); text-align: left; vertical-align: middle; }
table.tbl thead th {
  background: var(--surface-2); color: var(--ink-soft);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  position: sticky; top: 0; z-index: 1;
}
table.tbl tbody tr:hover { background: #f7fafb; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl td.mono { font-family: var(--mono); font-size: .82rem; }
table.tbl tr.clickable { cursor: pointer; }
table.tbl tfoot td { font-weight: 650; background: var(--surface-2); border-top: 2px solid var(--rule); }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-faint); }

/* ---------- Etichette di stato ---------- */
.tag {
  display: inline-block; padding: .1rem .45rem;
  border-radius: 2px; font-size: .72rem; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.tag-grey { background: var(--surface-2); color: var(--ink-soft); border-color: var(--rule); }
.tag-ok   { background: var(--ok-bg);   color: var(--ok);   border-color: #b9dcc9; }
.tag-warn { background: var(--warn-bg); color: var(--warn); border-color: #e8d0a6; }
.tag-bad  { background: var(--bad-bg);  color: var(--bad);  border-color: #e3bcbb; }

/* Semaforo del rischio creditizio. Non introduce colori propri: prende quelli
   dei tag di stato, cosi' verde/giallo/rosso vogliono dire qui la stessa cosa
   che vogliono dire sui documenti. Il pallino usa currentColor e segue da solo
   il tag su cui e' messo.
   Il colore non viaggia mai da solo: accanto resta sempre la parola, perche'
   a un daltonico il pallino non dice niente. */
.tag-semaforo::before {
  content: ''; display: inline-block;
  width: .5rem; height: .5rem; border-radius: 50%;
  background: currentColor; margin-right: .35rem;
}
/* In griglia serve il colpo d'occhio: il pallino da solo, con la parola
   nel title per chi ci passa sopra o usa un lettore di schermo. */
.semaforo-solo {
  display: inline-block; width: .6rem; height: .6rem;
  border-radius: 50%; border: 1px solid rgba(0, 0, 0, .18);
}
.semaforo-verde  { background: var(--ok); }
.semaforo-giallo { background: var(--warn); }
.semaforo-rosso  { background: var(--bad); }
.semaforo-vuoto  { background: transparent; border-style: dashed; border-color: var(--rule); }
/* Semaforo e dettagli sulla stessa riga sotto il campo Fido. */
.rating-riga { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }

/* ---------- Moduli ---------- */
.field { display: flex; flex-direction: column; gap: .2rem; margin-bottom: .75rem; }
/* Larghezza secondo il contenuto previsto (vedi fieldSize in ui.js): un
   numero o una data non hanno bisogno di tutta la riga. Nelle barre dei
   filtri i campi hanno gia' la loro misura. */
.field.w-xs > input, .field.w-xs > select { max-width: 6.5rem; }
.field.w-sm > input, .field.w-sm > select { max-width: 11rem; }
.field.w-md > input, .field.w-md > select { max-width: 17rem; }
.field.w-lg > input, .field.w-lg > select { max-width: 26rem; }
.filters .field > input, .filters .field > select { max-width: none; }
.field label { font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: .74rem; color: var(--ink-faint); }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=search], select, textarea {
  font: inherit; font-size: .88rem;
  padding: .38rem .5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
textarea { resize: vertical; min-height: 60px; }
.row { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.row-2 { grid-template-columns: 1fr 1fr; }
fieldset { border: 1px solid var(--rule); border-radius: var(--radius); padding: .85rem 1rem .3rem; margin: 0 0 1rem; }
legend { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 0 .35rem; }
.check { display: flex; align-items: center; gap: .45rem; }
.check input { width: auto; }

/* ---------- Barra filtri ---------- */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 130px; }
.filters .grow { flex: 1; min-width: 200px; }
/* Barra del periodo: si stacca dal contenuto, e' un comando non un dato. */
.period-bar {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: .6rem .8rem; box-shadow: var(--shadow);
}
.period-bar select, .period-bar input { min-width: 9.5rem; }
/* La spunta si allinea in fondo alla barra, non ai campi data. */
.period-bar .with-ddt { align-self: center; margin-left: .5rem; }
.period-bar .with-ddt input { min-width: 0; }

/* Campo con un pulsante accanto (per esempio "Cerca" sulla partita IVA). */
.con-azione { display: flex; gap: .35rem; }
.con-azione input { flex: 1; min-width: 0; }

/* ---------- Pannello laterale ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(16,35,48,.45); }
.sheet {
  position: relative; width: min(760px, 100%);
  background: var(--paper);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 30px rgba(0,0,0,.2);
  animation: slide .18s ease-out;
}
/* Allargato a tutto schermo: la preferenza la ricorda il browser. */
.sheet.wide { width: 100%; }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.1rem; background: var(--surface); border-bottom: 1px solid var(--rule); }
.sheet-head h2 { margin: 0; font-size: 1rem; }
/* Il margine automatico spinge freccia e X in fondo all'intestazione. In
   index.html e' ripetuto come stile in linea: se il foglio di stile arriva
   dalla cache del browser mentre l'HTML e' aggiornato, la freccia finirebbe
   altrimenti appiccicata al titolo. */
.sheet-wide {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: .2rem .35rem;
  border-radius: var(--radius); color: var(--ink-soft);
}
.sheet-wide:hover { background: var(--rule-soft); color: var(--ink); }
/* Sotto i 760px il pannello e' gia' a tutta larghezza: non c'e' niente da allargare. */
@media (max-width: 760px) { .sheet-wide { display: none; } }
.sheet-close { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--ink-soft); }
.sheet-body { flex: 1; overflow-y: auto; padding: 1.1rem; }
.sheet-foot { padding: .75rem 1.1rem; background: var(--surface); border-top: 1px solid var(--rule); display: flex; gap: .5rem; justify-content: flex-end; }

/* ---------- Righe documento ---------- */
.lines { width: 100%; border-collapse: collapse; font-size: .84rem; }
.lines th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); text-align: left; padding: .3rem .35rem; }
.lines td { padding: .18rem .2rem; border-bottom: 1px solid var(--rule-soft); }
.lines input, .lines select { padding: .28rem .4rem; font-size: .84rem; }

/*
 * Righe con tre sconti: undici colonne devono entrare senza barra di
 * scorrimento. Le colonne numeriche hanno larghezza fissa e stretta, e tutto
 * lo spazio che avanza va a descrizione e articolo, che sono le uniche a
 * contenere testo di lunghezza variabile.
 */
/* Con dodici colonne le due di testo (articolo e descrizione) verrebbero
   schiacciate a zero: si fissa una larghezza minima e, se lo spazio non
   basta, e' il contenitore a scorrere invece di comprimerle. Allargando il
   pannello con il comando in intestazione lo scorrimento sparisce. */
.lines-3sc { table-layout: fixed; min-width: 46rem; }
.lines-3sc th, .lines-3sc td { padding-left: .18rem; padding-right: .18rem; }
.lines-3sc th { font-size: .66rem; letter-spacing: .02em; white-space: nowrap; }
.lines-3sc input { width: 100%; padding: .28rem .3rem; }
.lines-3sc .w-um     { width: 3rem; }
.lines-3sc .w-qty    { width: 3.6rem; }
.lines-3sc .w-price  { width: 4.8rem; }
.lines-3sc .w-sc     { width: 3.1rem; }
.lines-3sc .w-amount { width: 6rem; }
/* Pulsanti sotto le righe: "Aggiungi riga" e "Riga libera" affiancati. */
.lines-actions { margin-top: .5rem; display: flex; gap: .4rem; flex-wrap: wrap; }
/* Casella "conta nel margine", solo su righe libere e servizi. */
.w-margin .in-margin { margin-left: .35rem; vertical-align: middle; }
/* L'importo e' scrivibile ma resta un risultato: bordo appena accennato,
   cosi' si distingue dai campi che si compilano sempre a mano. */
.lines .w-amount input {
  width: 100%; font-weight: 600;
  background: transparent; border-color: transparent;
}
.lines .w-amount input:hover  { border-color: var(--rule); }
.lines .w-amount input:focus  { background: var(--surface); border-color: var(--accent); }
/* Solo l'importo: la percentuale sta nel suggerimento, per non allargare. */
.lines-3sc .w-margin { width: 5.2rem; color: var(--ok); font-variant-numeric: tabular-nums; }
.lines-3sc .w-margin.neg { color: var(--bad); }
/* Riepilogo: il margine si stacca dai totali fiscali, e' un dato gestionale. */
.doc-totals .margin-row { border-top: 1px dashed var(--rule); color: var(--ok); }
.doc-totals .margin-row:first-of-type { margin-top: .4rem; }
.doc-totals .margin-row.neg { color: var(--bad); }
/* Riga di gran totale: resta attaccata in fondo mentre si scorre l'elenco. */
.tbl tfoot .tot-row td {
  position: sticky; bottom: 0;
  background: var(--surface-2); border-top: 2px solid var(--rule);
  font-variant-numeric: tabular-nums; padding-top: .55rem; padding-bottom: .55rem;
}
.tbl tfoot .tot-label { color: var(--ink-soft); font-weight: 600; }
.tbl .pos { color: var(--ok); }
.tbl .neg { color: var(--bad); }
.lines-3sc .w-del    { width: 1.4rem; }
/* Casella "movimenta il magazzino" di riga, solo su DDT e fatture. */
.lines-3sc .w-stock  { width: 2.4rem; text-align: center; }
.lines-3sc .w-stock input { width: auto; padding: 0; vertical-align: middle; }
/* Promemoria dello sconto di listino sopra le righe. */
.lines-hint {
  margin: 0 0 .5rem; padding: .35rem .6rem;
  background: var(--warn-bg); color: var(--warn);
  border-radius: var(--radius); font-size: .8rem;
}
/* Avviso dentro un pannello: p.es. la consultazione partita IVA ha dovuto
   ripiegare su VIES perche' il servizio a pagamento non ha risposto. */
.hint.warn {
  padding: .35rem .6rem; margin-bottom: .5rem;
  background: var(--warn-bg); color: var(--warn);
  border-radius: var(--radius);
}
/* Sconto pagamento spento: si vede che c'e' ma non e' disponibile. */
.lines-3sc input:disabled { background: var(--surface-2); color: var(--ink-faint); cursor: not-allowed; }
.lines .del { background: none; border: 0; color: var(--ink-faint); cursor: pointer; font-size: 1.1rem; padding: 0 .3rem; }
.lines .del:hover { color: var(--bad); }
.doc-totals { margin-top: .75rem; margin-left: auto; width: min(280px, 100%); }
.doc-totals div { display: flex; justify-content: space-between; padding: .2rem 0; font-variant-numeric: tabular-nums; }
.doc-totals .grand { border-top: 2px solid var(--rule); margin-top: .3rem; padding-top: .4rem; font-weight: 700; font-size: 1.05rem; }

/* ---------- Ricerca articolo ---------- */
.picker { position: relative; }
/*
 * L'elenco vive attaccato al body, non dentro la riga, ed e' posizionato
 * rispetto alla finestra: l'editor righe sta dentro .table-wrap, che scorre
 * e quindi ritaglierebbe qualunque cosa esca dai suoi bordi. Coordinate e
 * larghezza le calcola il codice, allineandolo al campo.
 */
.picker-list {
  position: fixed; z-index: 80;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(16,35,48,.18); overflow-y: auto;
}
/* Tre colonne: codice, descrizione, disponibilita'. Incolonnate, cosi'
   l'occhio scorre in verticale invece di rileggere ogni riga per intero. */
.picker-list button {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  align-items: baseline; gap: .1rem .7rem;
  width: 100%; text-align: left;
  padding: .42rem .7rem; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: .875rem; color: var(--ink);
  border-bottom: 1px solid var(--rule-soft);
}
.picker-list button:hover, .picker-list button.on { background: var(--surface-2); }
.picker-list button.on { box-shadow: inset 3px 0 0 var(--accent); }
.picker-list .code { font-family: var(--mono); font-size: .78rem; color: var(--accent); }
/* Una riga sola: le descrizioni lunghe si troncano invece di far ballare
   l'altezza delle righe. Il testo intero resta nel suggerimento. */
.picker-list .descr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-list .avail { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.picker-list .avail b { font-weight: 650; }
.picker-list .avail small { font-size: .72rem; color: var(--ink-faint); }
.picker-msg { padding: .6rem .7rem; font-size: .85rem; color: var(--ink-soft); }
/* Categorie: restano in vista mentre si scorre l'elenco sotto. */
.picker-cats {
  position: sticky; top: 0; z-index: 1;
  display: flex; flex-wrap: wrap; gap: .25rem;
  padding: .35rem .4rem; background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.picker-list button.picker-cat {
  display: inline-block; width: auto; border: 1px solid var(--rule);
  border-radius: 999px; padding: .12rem .5rem; font-size: .74rem;
  color: var(--ink-soft); white-space: nowrap;
}
.picker-list button.picker-cat.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Avvisi ---------- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  background: var(--ink); color: #fff;
  padding: .6rem .9rem; border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: .86rem;
  max-width: 380px; animation: pop .16s ease-out;
}
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

.loading { padding: 2rem; text-align: center; color: var(--ink-faint); }

/* ---------- Grafico a colonne ---------- */
.bars { display: flex; align-items: flex-end; gap: .5rem; height: 150px; padding-top: .5rem; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .3rem; height: 100%; }
.bars .bar i { display: block; width: 100%; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; }
.bars .bar span { font-size: .7rem; color: var(--ink-faint); }
.bars .bar b { font-size: .72rem; font-variant-numeric: tabular-nums; }

/* ---------- Schermi stretti ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .app.menu-open .sidebar { transform: none; }
  .app.menu-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(16,35,48,.4); z-index: 30; }
  .main { margin-left: 0; }
  .hamburger, .sidebar-close { display: block; }
  .view { padding: .85rem; }
}

/* ---------- Stampa ---------- */
@media print {
  .sidebar, .topbar, .sheet-foot, .toasts, .filters { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; font-size: 11pt; }
  .card { border: 0; box-shadow: none; }
}
