/*
 * Stile gestionale La gabbianella — light/dark, minimal moderno.
 * I colori vivono in variabili: il tema si cambia su <html data-theme="...">.
 */

:root {
  --bg: #fcfcfe;       /* canvas quasi bianco: righe bianche appena staccate + bordo */
  --surface: #ffffff;
  --surface-2: #eceef6;
  --row-bg: var(--surface);   /* righe bianche che spiccano sul canvas grigio */
  --text: #2c3557;
  --muted: #7078a0;
  --border: #e3e5f1;
  --accent: #526496;          /* indaco/periwinkle del brand (dal logo) */
  --accent-contrast: #ffffff;
  --indigo: #606aa3;          /* periwinkle della striscia alta del sito */
  --danger: #b42318;
  --danger-bg: #fdecea;
  --ok: #1a7f47;
  --ok-bg: #e7f4ec;
  --radius: 10px;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --shadow: 0 1px 2px rgba(34, 42, 82, .06), 0 1px 3px rgba(34, 42, 82, .05);
  /* Tema light: navbar del colore principale, logo su tessera bianca. */
  --topbar-bg: var(--accent);
  --topbar-text: #ffffff;
  --brand-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e1e1e;
    --surface: #252526;
    --surface-2: #2d2d30;
    --row-bg: var(--surface);   /* dark: riga come le altre superfici (già staccata dal fondo) */
    --text: #ffffff;
    --muted: #9a9aa5;
    --border: #3a3a3d;
    --accent: #d4d4d8;
    --accent-contrast: #1e1e1e;
    --indigo: #d4d4d8;
    --danger: #ff7b72;
    --danger-bg: #2d1715;
    --ok: #56d364;
    --ok-bg: #11261a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45);
    --topbar-bg: var(--surface);
    --topbar-text: #ffffff;
    --brand-bg: transparent;
  }
}

:root[data-theme="dark"] {
  --bg: #1e1e1e;
  --surface: #252526;
  --surface-2: #2d2d30;
  --row-bg: var(--surface);
  --text: #ffffff;
  --muted: #9a9aa5;
  --border: #3a3a3d;
  --accent: #d4d4d8;
  --accent-contrast: #1e1e1e;
  --indigo: #d4d4d8;
  --danger: #ff7b72;
  --danger-bg: #2d1715;
  --ok: #56d364;
  --ok-bg: #11261a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45);
  --topbar-bg: var(--surface);
  --topbar-text: #ffffff;
  --brand-bg: transparent;
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }
/* Segue il toggle manuale, non solo la preferenza di sistema: altrimenti
   con OS in dark mode i controlli nativi (checkbox, radio) restano scuri
   anche quando l'utente ha forzato il tema chiaro (e viceversa), risultando
   poco visibili sullo sfondo del tema attivo. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .6rem 1.5rem;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background: var(--brand-bg);
  padding: .3rem .55rem;
  border-radius: var(--radius);
}

/* Wordmark ufficiale (uccellino + logotipo). Su tema scuro lo schiariamo
   perché è indaco su trasparente e sparirebbe. */
.brand-logo {
  display: block;
  height: 48px;
  width: auto;
  border-radius: 0;
}

:root[data-theme="dark"] .brand-logo { filter: brightness(0) invert(1) brightness(1.1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo { filter: brightness(0) invert(1) brightness(1.1); }
}

.nav {
  display: flex;
  gap: 1.5rem;
  flex: 1;
}

.nav a {
  color: var(--topbar-text);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.nav a:hover { opacity: .75; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

/* Rotella impostazioni: icona sobria nella topbar, stesso colore delle voci. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  color: var(--topbar-text);
  line-height: 0;
  opacity: .85;
}
.icon-btn:hover { opacity: 1; }

/* Bolla "Indietro": pill appena sotto la topbar, a sinistra. `fixed` (ancorata al
   viewport, fuori dal flusso) così, comparendo solo dopo un redirect, non spinge in
   giù il contenuto. top ≈ altezza topbar (logo 48px + padding). z-index sopra la
   topbar (10) ma sotto i flash (60). ponytail: top fisso, ritoccare se cambia la navbar. */
.back-bubble {
  position: fixed;
  top: 5.2rem;
  left: 1.5rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .8rem .35rem .55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  color: var(--muted);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.back-bubble:hover { color: var(--text); border-color: var(--accent); }

/* Bottone Esci nella topbar: leggibile sia su fondo colorato (light) che scuro. */
.topbar .btn-ghost {
  color: var(--topbar-text);
  border-color: color-mix(in srgb, var(--topbar-text) 45%, transparent);
}
.topbar .btn-ghost:hover {
  color: var(--topbar-text);
  border-color: var(--topbar-text);
  background: color-mix(in srgb, var(--topbar-text) 12%, transparent);
}

/* Interruttore tema: slider minimale (knob a sinistra=chiaro, destra=scuro). */
.theme-switch {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  line-height: 0;
}
.theme-switch-track {
  display: inline-block;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--topbar-text) 30%, transparent);
  border: 1px solid color-mix(in srgb, var(--topbar-text) 45%, transparent);
  position: relative;
}
.theme-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--topbar-text);
  transition: transform .15s ease;
}
:root[data-theme="dark"] .theme-switch-knob { transform: translateX(18px); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-switch-knob { transform: translateX(18px); }
}

/* ---- Layout ---- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: -.01em;
  margin: .2rem 0 1rem;
}
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  margin: 2rem 0 .75rem;
}

a { color: var(--accent); }

.muted { color: var(--muted); }

/* ---- Tabelle ---- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

th, td {
  text-align: left;
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  font-size: .95rem;
}

th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .03em;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }

/* Azioni per riga (Modifica/Elimina): in linea e compatte. */
.row-actions { display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.row-actions form { margin: 0; }
.row-actions .btn-ghost { padding: .2rem .55rem; font-size: .85rem; }

/* Pill uniforme per le etichette d'azione/stato (es. Scarico: "Storna" e "chiuso"). */
.pill {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.35;
}
.pill-muted { background: var(--surface-2); color: var(--muted); }
button.pill-action {
  background: transparent;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  cursor: pointer;
}
button.pill-action:hover { background: var(--danger-bg); }

/* ---- Liste descrittive ---- */
dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .4rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

dt { color: var(--muted); }
dd { margin: 0; font-weight: 500; }

/* ---- Form ---- */
form { max-width: 520px; }

.field { margin-bottom: 1rem; }

label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .3rem; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
input[type="file"],
select {
  width: 100%;
  padding: .55rem .65rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 0 1rem;
}

legend { color: var(--muted); font-size: .85rem; padding: 0 .4rem; }

fieldset label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin: 0 1rem .4rem 0;
  color: var(--text);
}

fieldset input[type="checkbox"] { width: auto; }

/* ---- Bottoni ---- */
input[type="submit"], .btn-primary, button {
  cursor: pointer;
  font: inherit;
}

input[type="submit"], .btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border: 0;
  border-radius: var(--radius);
  padding: .6rem 1.1rem;
  font-weight: 600;
}

input[type="submit"]:hover, .btn-primary:hover { filter: brightness(1.05); }

/* Variante distruttiva (es. "Elimina selezionate"). Selettore combinato per
   battere la specificità di input[type="submit"]. */
input[type="submit"].btn-danger, .btn-danger { background: var(--danger); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem .8rem;
}

.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

/* button_to genera un form: niente margine extra */
.topbar-actions form { margin: 0; }

/* ---- Ricerca ---- */
form.search {
  display: flex;
  gap: .5rem;
  align-items: center;
  max-width: none;
  margin-bottom: 1rem;
}

form.search input[type="text"] { flex: 1; }
form.search .btn-primary { white-space: nowrap; }

/* ---- Flash ---- */
.flashes {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 60;
  width: min(92vw, 34rem);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;   /* i click passano alla pagina; solo i toast li ricevono */
}
.flash {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  margin: 0;
  font-size: .95rem;
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.flash-notice { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-alert { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* I notice spariscono da soli; gli alert (errori) restano visibili */
.flash-notice { animation: flash-vanish .5s ease 4s forwards; }
@keyframes flash-vanish {
  to { opacity: 0; visibility: hidden; display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .flash-notice { animation-duration: 0s; }
}

/* ---- Errori di form ---- */
form ul {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius);
  padding: .6rem 1rem .6rem 2rem;
  margin: 0 0 1rem;
}

/* ---- Card login ---- */
.auth-card {
  max-width: 380px;
  margin: 4rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.auth-logo { height: auto; width: min(220px, 70%); margin: 0 auto 1.5rem; }
.auth-card h1 { margin-top: 0; }
.auth-card form { max-width: none; }

/* ---- Catalogo a tutta larghezza (esce dal contenitore da 960px). La scheda
   (drawer destro) resta un overlay: da aperta riserva la sua larghezza (+ linguetta),
   da chiusa solo la metà, così la tabella non le finisce sotto. I filtri invece
   sono un box in linea sopra la ricerca: niente spazio da riservare a sinistra. ---- */
.catalog {
  position: relative;
  margin-inline: calc(50% - 50vw);
  padding-left: 20%;
  padding-right: 20%;
  transition: padding .2s ease;
}
/* A scheda aperta il padding destro sale a coprire la larghezza del drawer
   (+ linguetta), così la tabella non le finisce sotto. */
:root[data-detail="open"] .catalog { padding-right: max(20%, calc(440px + 4.5rem)); }

/* Drawer dettaglio: scorre da destra SOPRA il contenuto (come i filtri da
   sinistra), senza resize della tabella né oscurare la pagina. Si apre quando si
   clicca un prodotto (turbo-frame caricato), si chiude con la × o Esc. */
.detail-drawer {
  position: fixed;
  top: 5rem;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: 440px;
  max-width: 92vw;
  transform: translateX(100%);
  transition: transform .2s ease;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -6px 0 18px rgba(0, 0, 0, .18);
  overflow-y: auto;
  padding: 1.1rem 1.25rem 2rem;
}
:root[data-detail="open"] .detail-drawer { transform: translateX(0); }

/* Linguetta con freccia, agganciata al bordo destro: apre/chiude il dettaglio
   (specchio della linguetta filtri a sinistra). */
.detail-handle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 31;
  min-width: 40px;
  min-height: 150px;
  padding: .55rem .3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  box-shadow: -3px 0 10px rgba(15, 18, 40, .14);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: right .2s ease, color .15s ease;
}
.detail-handle:hover { color: var(--text); }
.detail-handle::before { content: "‹"; font-size: 1.4rem; line-height: 1; }
.detail-handle-label { font-size: .62rem; font-weight: 600; letter-spacing: .02em; }
:root[data-detail="open"] .detail-handle { right: min(440px, 92vw); }
:root[data-detail="open"] .detail-handle::before { content: "›"; }

.detail-drawer h1 { font-size: 1.4rem; margin: .2rem 0 .6rem; }
.detail-drawer h2 { font-size: 1.05rem; }
.detail-empty { margin: 0; }

/* Immagini della scheda adattate alla larghezza del drawer. */
.detail-drawer .gallery-main { max-width: 100%; height: auto; }
.detail-drawer span.gallery-main {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}

/* Scheda anagrafica modificabile in loco: la tabella dei dettagli (.detail-fields)
   è essa stessa il blocco visivo (bordo, colonna etichette ombreggiata, righe
   separate), come la tabella delle righe della fattura. */
.detail-edit { max-width: none; margin: 0 0 .9rem; }
.detail-fields { width: 100%; margin: 0; }
.detail-fields th, .detail-fields td { vertical-align: middle; }
.detail-fields th {
  text-align: left; font-weight: normal; text-transform: none; letter-spacing: 0;
  color: var(--muted); font-size: .9rem; white-space: nowrap; width: 1%;
}
.detail-fields td.ro { font-weight: 500; }
.detail-fields input { width: 100%; margin: 0; }
/* Salva: nascosto finché non si modifica un campo (form "sporco"). */
.detail-edit .form-errors { margin-bottom: .6rem; }
.detail-edit .detail-save { margin-top: .7rem; display: none; }
.detail-edit.is-dirty .detail-save { display: block; }

/* Bottoni sotto la scheda (Scarica, Etichetta, Archivia). */
.detail-actions { display: flex; gap: .6rem; margin: 1.4rem 0; }
.detail-actions form { margin: 0; }

/* Riga con interruttore (checkbox) + testo, es. impostazioni. */

/* Modale <dialog> (es. Scarico): finestra centrata sopra la pagina. */
.modal {
  width: min(460px, 92vw);
  max-width: none;
  padding: 1rem 1.25rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(15, 18, 40, .3);
}
.modal::backdrop { background: rgba(15, 18, 40, .45); }
.modal .modal-close-row { margin: 0; display: flex; justify-content: flex-end; }
.modal .modal-close {
  padding: 0 .2rem;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.modal .modal-close:hover { color: var(--text); }
.modal .modal-title { margin: 0 0 .2rem; }

/* Quantità scarico: controllo compatto con −/+; lo spinner nativo è nascosto. */
.quantity-stepper {
  display: grid;
  grid-template-columns: 2.75rem minmax(5rem, 1fr) 2.75rem;
  align-items: stretch;
}
.quantity-stepper input {
  min-width: 0;
  margin: 0;
  border-radius: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.quantity-stepper input::-webkit-inner-spin-button,
.quantity-stepper input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}
.quantity-stepper-button {
  margin: 0;
  padding: .45rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.quantity-stepper-button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: 0;
}
.quantity-stepper-button:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: 0;
}
.quantity-stepper-button:hover { background: var(--border); }
.quantity-stepper-button:focus-visible { position: relative; z-index: 1; }

/* Dialog di conferma (sostituisce il popup nativo di Turbo). */
.confirm-message { margin: 0 0 .3rem; }
.confirm-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.1rem; }

/* Modale largo per l'anteprima del documento PDF: iframe a tutta larghezza. */
.modal-wide { width: min(900px, 95vw); max-width: 95vw; padding: 0; }
.modal-doc-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .55rem .8rem;
}
.modal-doc-frame { width: 100%; height: 75vh; border: 0; display: block; }

/* Selettore e anteprima dei quattro layout DYMO. */
.label-format-picker {
  display: grid; grid-template-columns: 1fr 1fr; gap: .45rem;
  width: 100%; margin: .8rem 0; padding: 0; border: 0;
}
.label-format-picker legend { margin-bottom: .35rem; font-weight: 600; }
.label-format-picker label {
  display: grid; grid-template-columns: auto 1fr; column-gap: .45rem;
  align-items: center; margin: 0; padding: .55rem;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.label-format-picker label:has(input:checked) {
  border-color: var(--accent); background: var(--surface-2);
}
.label-format-picker input { grid-row: 1 / span 2; margin: 0; width: auto; }
.label-format-picker span { font-size: .88rem; font-weight: 600; }
.label-format-picker small { color: var(--muted); }
.label-roll-hint {
  width: 100%; margin: 0; padding: .65rem .8rem;
  border-left: 4px solid var(--accent); background: var(--surface-2);
}
.label-previews {
  min-height: 38mm; width: 100%;
  display: grid; place-items: center; margin: .5rem 0 1rem;
}
.label-preview { display: none; justify-content: center; align-items: center; }
.label-preview.is-active { display: flex; }
.label-preview .label {
  box-sizing: border-box; display: flex; align-items: center; justify-content: center;
  overflow: hidden; text-align: center; background: #fff; color: #000;
  border: 1px solid var(--border); border-radius: 4px;
}
.label-preview .label-content {
  width: 100%; height: 100%; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
}
.label-preview .desc { overflow: hidden; font-weight: 700; }
.label-preview svg { display: block; width: 100%; }
.label-preview .price { flex: none; font-weight: 800; }
.label-preview .label--piccola_nome,
.label-preview .label--piccola_barcode { width: 25mm; height: 13mm; padding: .8mm 1mm; }
.label-preview .label--piccola_nome .desc { max-height: 7mm; font-size: 6pt; line-height: 1.05; }
.label-preview .label--piccola_nome .price,
.label-preview .label--piccola_barcode .price { font-size: 8.5pt; line-height: 1; }
.label-preview .label--piccola_barcode svg { height: 6.5mm; }
.label-preview .label--media { width: 51mm; height: 19mm; padding: 1.2mm 2mm; }
.label-preview .label--media .desc {
  max-height: 4.5mm; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 7pt; line-height: 1.05;
}
.label-preview .label--media svg { height: 8mm; }
.label-preview .label--media .price { font-size: 10pt; line-height: 1; }
.label-preview .label--grande { width: 89mm; height: 36mm; padding: 2mm 3mm; gap: 3mm; }
.label-preview .label--grande .label-brand {
  width: 32mm; flex: none; display: flex; align-items: center; justify-content: center;
}
.label-preview .label--grande .label-brand img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(1) contrast(3);
}
.label-preview .label--grande .label-content { flex: 1; }
.label-preview .label--grande .desc { max-height: 9mm; font-size: 10pt; line-height: 1.05; }
.label-preview .label--grande svg { height: 13mm; }
.label-preview .label--grande .price { font-size: 16pt; line-height: 1; }
.etichetta-print {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .8rem; margin: 0; max-width: none;
}
.etichetta-print > label {
  display: flex; align-items: center; gap: .4rem; margin: 0; color: var(--text);
}
.etichetta-print input { width: 4rem; margin: 0; }
.etichetta-print .label-format-picker input { width: auto; }
.etichetta-print [type="submit"] { flex: none; width: max-content; }
.dymo-print-status { flex-basis: 100%; margin: 0; }
.dymo-status[data-state="success"],
.dymo-print-status[data-state="success"] { color: var(--success, #16803a); font-weight: 600; }
.dymo-status[data-state="error"],
.dymo-print-status[data-state="error"] { color: var(--danger, #b42318); font-weight: 600; }
.dymo-setup {
  max-width: 48rem; margin-top: 2rem; padding: 1.2rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.dymo-setup h2 { margin-top: 0; }
.dymo-setup h3 { margin-top: 0; }
.dymo-setup-actions { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.dymo-setup-actions select { min-width: 18rem; width: auto; margin: 0; }
.settings-tabs {
  display: flex; gap: .35rem; margin-bottom: 1.5rem;
  overflow-x: auto; border-bottom: 1px solid var(--border);
}
.settings-tabs a {
  padding: .7rem 1rem; color: var(--muted); text-decoration: none;
  white-space: nowrap; border-bottom: 3px solid transparent;
}
.settings-tabs a.is-active {
  color: var(--text); font-weight: 700; border-bottom-color: var(--accent);
}
.dymo-config-redirect {
  flex-basis: 100%; padding: .85rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg);
}
.dymo-config-redirect[hidden] { display: none; }
.dymo-config-redirect p { margin: 0 0 .7rem; }
@media (max-width: 600px) {
  .label-format-picker { grid-template-columns: 1fr; }
  .label-preview .label--grande { transform: scale(.82); }
}

/* Le tabelle secondarie (movimenti, cronologia) nel drawer stretto: niente
   scroll orizzontale, le righe diventano schede etichettate (data-label).
   Container query: succede solo dove il contenitore è stretto (il drawer),
   non a pagina piena. */
.detail-tables { container-type: inline-size; }
@container (max-width: 520px) {
  .detail-tables table { border: 0; box-shadow: none; background: transparent; }
  .detail-tables thead { display: none; }
  .detail-tables tbody tr {
    display: block;
    padding: .5rem .7rem;
    margin-bottom: .6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .detail-tables tbody tr:hover td { background: transparent; }
  .detail-tables td {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .4rem 1rem;
    padding: .2rem 0;
    border: 0;
  }
  .detail-tables td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
  }
  .detail-tables td.row-actions { justify-content: flex-start; }
  .detail-tables td.row-actions::before { display: none; }
}

/* Righe fattura nel drawer: tabella classica compatta, numeri a destra, scorre
   in orizzontale se il drawer è troppo stretto. */
.invoice-head { margin-bottom: 1.4rem; }
.detail-righe { overflow-x: auto; }
.detail-righe th, .detail-righe td { padding: .45rem .55rem; }
.detail-righe .num { text-align: right; white-space: nowrap; }

/* Prodotto selezionato: resta evidenziato anche a drawer chiuso. */
.product-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }

/* Col dettaglio aperto il FAB "aggiungi" sparisce, per non coprirlo. */
:root[data-detail="open"] .fab { display: none; }

/* Box filtri (<details>) sotto la barra di ricerca: si apre/chiude cliccando
   l'intestazione; la × chiude. Da aperto i blocchi vanno in riga (orizzontale). */
.filters-box {
  margin: 0 0 .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.filters-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .9rem;
  font-size: .9rem;
  color: var(--text);
}
.filters-summary::-webkit-details-marker { display: none; }
.filters-summary::after {
  content: "▸";
  color: var(--muted);
  font-size: .8rem;
  transition: transform .15s ease;
}
.filters-box[open] .filters-summary::after { transform: rotate(90deg); }
.filters-body {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: .75rem 2rem;
  padding: .25rem 2.2rem .85rem 1rem;
  border-top: 1px solid var(--border);
}
.filters-close {
  position: absolute;
  top: .4rem;
  right: .5rem;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 .2rem;
}
.filters-close:hover { color: var(--text); }

.filter-block { display: flex; flex-direction: column; gap: .4rem; }
.filter-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }

.filter-select { margin: 0; max-width: none; }
.filter-select select {
  font-size: .85rem;
  padding: .35rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: transparent;
}

.chip-group { display: flex; gap: .4rem; }
.chip-group a {
  font-size: .85rem;
  padding: .35rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
}
.chip-group a:hover { border-color: var(--accent); color: var(--text); }
.chip-group a.active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.chip-reset { font-size: .85rem; color: var(--muted); text-decoration: underline; }
.chip-reset:hover { color: var(--text); }

/* ---- Catalogo: ricerca; sotto, il box filtri e la barra vista/ordinamento. ---- */
.catalog-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: 0 0 .6rem; }
.catalog-toolbar .search { flex: 1 1 260px; margin: 0; }

.view-bar { margin: 0 0 1rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.view-icons { display: flex; gap: .35rem; }

/* Ordinamento e risultati per pagina raggruppati, a destra delle icone vista. */
.list-controls { display: flex; align-items: center; gap: .5rem; }
.sort-form { margin: 0; display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
.sort-form label, .perpage-form label {
  display: flex; align-items: center; gap: .4rem; margin: 0;
}
.sort-form select, .perpage-form select { width: auto; font-size: .82rem; padding: .35rem .5rem; }
.sort-dir-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
}
.sort-dir-btn:hover { border-color: var(--accent); color: var(--text); }
.perpage-form { margin: 0; display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }

/* ---- Feedback di caricamento durante le navigazioni Turbo ----
   Barra in alto per le visite piene (menu, filtri, cambio vista); leggera
   sbiadita del frame mentre carica (ricerca, ordinamento, paginazione, scheda):
   risposte veloci non lampeggiano, quelle lente segnalano subito l'attesa. */
.turbo-progress-bar { height: 3px; background: var(--accent); }
/* I turbo-frame sono inline di default: da blocco l'opacità (sotto) fa effetto e
   il box contiene bene i figli a blocco. */
turbo-frame { display: block; }
turbo-frame[aria-busy="true"] { opacity: .6; transition: opacity .12s ease; }
#catalog[aria-busy="true"] { cursor: progress; }
.view-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}
.view-icons a:hover { border-color: var(--accent); color: var(--text); }
.view-icons a.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.view-icons svg { display: block; }

/* Intestazioni colonne sopra la lista (lista / foto piccole). */
/* Stessa gap/padding delle righe (+ bordo trasparente che compensa il bordo da
   1px delle righe) così le colonne dell'intestazione si allineano con i dati. */
.list-head { display: flex; align-items: center; gap: 1rem; padding: .1rem .9rem .35rem; border: 1px solid transparent; }
.list-head-thumb { flex: 0 0 56px; }
.list-head .product-info {
  flex: 1;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  color: var(--muted);
}

.product-item { color: var(--text); text-decoration: none; }
.product-thumb { display: block; }
.product-thumb img { display: block; }
.product-code { color: var(--muted); font-size: .8rem; }
.product-desc { font-weight: 600; }
.product-price { font-weight: 600; white-space: nowrap; }
.product-cost, .product-markup { white-space: nowrap; }

/* Modalità a righe: lista e foto piccole. Colonne a larghezza fissa → si allineano fra righe. */
.view-lista, .view-mini { display: flex; flex-direction: column; gap: .4rem; }
.view-lista .product-item, .view-mini .product-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .7rem .9rem;
  background: var(--row-bg);
  border: 1px solid var(--border);
  border-radius: 0;
  font-size: 1.02rem;
}
.view-lista .product-item:hover, .view-mini .product-item:hover { border-color: var(--accent); }
.view-mini .product-thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.view-mini .product-thumb img { width: 56px; height: 56px; object-fit: cover; }
/* Griglia colonne condivisa da intestazione e righe: larghezze fisse così le
   colonne si allineano tra le righe. */
.list-head .product-info,
.view-lista .product-info, .view-mini .product-info {
  flex: 1;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 130px 95px 105px 90px;
  column-gap: 0;
  row-gap: .1rem;
  align-items: center;
}
.product-info > * { padding-right: 1rem; min-width: 0; }

/* Modalità griglia: foto grandi. */
/* Numero di colonne legato al VIEWPORT (non alla larghezza del contenitore):
   quando la scheda si apre e restringe il catalogo, il conteggio non cambia →
   le card si ridimensionano in modo fluido invece di rifloware. */
.view-foto {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (min-width: 950px)  { .view-foto { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1150px) { .view-foto { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1350px) { .view-foto { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1550px) { .view-foto { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1800px) { .view-foto { grid-template-columns: repeat(7, 1fr); } }
.view-foto .product-item {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.view-foto .product-item:hover { border-color: var(--accent); }
.view-foto .product-thumb { width: 100%; aspect-ratio: 1; background: var(--surface-2); }
.view-foto .product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.view-foto .product-info { display: flex; flex-direction: column; gap: .2rem; padding: .65rem .8rem; }

@media (max-width: 640px) {
  .view-lista .product-info, .view-mini .product-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .1rem;
  }
  .list-head { display: none; }  /* le colonne si impilano: l'intestazione non allinea più */
}

/* Impaginazione del catalogo. */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.25rem 0 .5rem;
}
.pagination .page-link {
  padding: .4rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.pagination .page-link:hover { border-color: var(--accent); }
.pagination .page-link.disabled { color: var(--muted); opacity: .5; pointer-events: none; }
.pagination .page-info { color: var(--muted); font-size: .9rem; }

/* Segnaposto per i prodotti senza foto: tessera colorata (nessun testo). */
.thumb-placeholder { display: block; width: 100%; height: 100%; }

/* Galleria sulla scheda prodotto. */
.gallery-main { width: 100%; max-width: 320px; }

/* Slideshow stile Instagram: una foto per volta, frecce laterali e pallini sotto. */
.slideshow { position: relative; }
.slides { position: relative; width: 100%; aspect-ratio: 1; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }
.slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .2s ease; border-radius: 0; cursor: zoom-in; pointer-events: none; }
.slide.is-active { opacity: 1; pointer-events: auto; }
.slide-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; line-height: 1; color: var(--text);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
}
.slide-nav:hover { border-color: var(--accent); }
.slide-prev { left: .5rem; }
.slide-next { right: .5rem; }
.slide-dots { display: flex; justify-content: center; gap: .4rem; margin-top: .6rem; }
.slide-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: var(--border); cursor: pointer; }
.slide-dot.is-active { background: var(--accent); }

/* Galleria nel form: anteprime con azioni principale/elimina. */
.form-gallery { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .75rem; }
.form-gallery-item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.form-gallery-item img { width: 100px; height: 100px; object-fit: cover; }
.form-gallery-item label { display: inline-flex; align-items: center; gap: .3rem; margin: 0; color: var(--text); font-size: .8rem; }

/* ---- Caricamento immagini in blocco: bubble cliccabile (label), niente pulsanti
   dentro. Le miniature scelte si spuntano/eliminano prima di caricarle. ---- */
.dropzone {
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 0;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}
.dropzone.is-over { border-color: var(--accent); background: var(--surface-2); }
.dropzone-input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.dropzone-previews {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: .5rem;
  margin-top: .75rem;
  text-align: left;
  /* Con molte immagini la bolla non cresce all'infinito: scrolla al suo interno. */
  max-height: 40vh;
  overflow-y: auto;
}
.dropzone-thumb {
  position: relative;
  border: 2px solid var(--accent);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}
.dropzone-thumb.is-off { border-color: var(--border); opacity: .45; }
.dropzone-thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 0; }
.dropzone-thumb-del {
  position: absolute; top: 2px; right: 2px; z-index: 2;
  width: 18px; height: 18px; padding: 0; line-height: 16px;
  border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: .85rem; cursor: pointer;
}


/* ---- Badge giacenza ---- */
.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  padding: .1rem .45rem;
  border-radius: 999px;
  margin-left: .35rem;
  vertical-align: middle;
}
.badge-out { background: var(--danger-bg); color: var(--danger); }

/* ---- Immagini prodotto ---- */
img { border-radius: var(--radius); max-width: 100%; height: auto; }

/* ---- Banco di lavoro immagini: foto (60%) a sinistra, prodotti (40%) a destra.
   Esce dal contenitore da 960px come il catalogo, per avere spazio ai due pannelli. ---- */
.img-workbench {
  max-width: none;
  margin-inline: calc(50% - 50vw);
  padding-inline: clamp(1rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) { .img-workbench { grid-template-columns: 1fr; } }
/* In "scollega" il pannello prodotti non c'è: le foto occupano tutta la larghezza. */
.img-workbench.solo-foto { grid-template-columns: 1fr; }

/* Interruttore modalità (collega / scollega): due voci in un pill, l'attiva evidenziata. */
.mode-toggle {
  display: inline-flex; gap: .25rem;
  margin: 0 0 1.2rem; padding: .25rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px;
}
.mode-toggle a {
  padding: .4rem 1.1rem; border-radius: 999px;
  font-size: .9rem; font-weight: 600;
  color: var(--muted); text-decoration: none;
}
.mode-toggle a.active { background: var(--accent); color: var(--accent-contrast); }

/* Pannello foto: griglia di tessere spuntabili. Come .pick-list a destra, scrolla
   al proprio interno oltre una certa altezza invece di far scrollare tutta la
   pagina. L'altezza è calcolata sottraendo a 100vh gli ingombri fissi sopra
   (topbar 78px + padding del container 24px) e sotto (padding container 64px +
   filtro/paginazione ~114px), così la griglia usa tutto lo spazio verticale
   davvero disponibile invece di fermarsi a metà schermo. */
.photo-toolbar { margin: 0 0 .8rem; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .9rem;
  margin-bottom: 1rem;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
}
.photo-card {
  position: relative;
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
}
.photo-card:has(.photo-check:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}
.photo-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 0; }
.photo-check { position: absolute; top: .5rem; left: .5rem; width: 20px; height: 20px; z-index: 2; cursor: pointer; }
/* Unica azione sulla tessera: la lente, centrata sull'immagine e visibile al
   passaggio. Il contenitore resta click-through (pointer-events: none) così cliccare
   la foto continua a spuntare la checkbox del <label>; solo il bottone è cliccabile. */
.photo-actions {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
.photo-card:hover .photo-actions { opacity: 1; }
.photo-zoom {
  pointer-events: auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; cursor: pointer;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.photo-zoom:hover { background: var(--surface-2); }

/* Lightbox: <dialog> nativo per l'ingrandimento, si apre in sovrapposizione. */
.lightbox {
  padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 90vh;
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; gap: .6rem; }
.lightbox::backdrop { background: rgba(0, 0, 0, .75); }
.lightbox > img { display: block; max-width: 82vw; max-height: 90vh; border-radius: var(--radius); }
.lightbox-nav {
  flex: none; width: 44px; height: 44px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .45); background: rgba(0, 0, 0, .4);
  color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.lightbox-nav:hover { background: rgba(0, 0, 0, .7); }
.lightbox-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
  width: min(70vw, 900px); max-height: 85vh; overflow-y: auto;
  padding: 1rem; background: var(--surface); border-radius: var(--radius);
}
.lightbox-grid img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); }
.lightbox-empty { grid-column: 1 / -1; margin: 0; }

/* Pannello prodotti: elenco cercabile e paginato; spunta radio + foto poi "Collega". */
.pick-search-form { margin: 0 0 .6rem; max-width: none; }
.pick-search { width: 100%; }
/* Griglia colonne condivisa da intestazione e righe: stesse larghezze fisse così
   codice/descrizione si allineano tra le righe (come il catalogo). */
.pick-head, .pick-item {
  display: grid;
  grid-template-columns: 20px 56px 100px minmax(0, 1fr);
  align-items: center; gap: .6rem;
}
.pick-head {
  padding: .1rem .6rem .35rem;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
  color: var(--muted);
}
/* Stesso ragionamento di .photo-grid: 100vh meno gli ingombri fissi sopra (102px)
   e sotto (padding container 64px + intestazione/paginazione ~211px). */
.pick-list {
  display: flex; flex-direction: column; gap: .35rem;
  max-height: calc(100vh - 395px); overflow-y: auto;
}
.pick-item {
  padding: .45rem .5rem;
  background: var(--row-bg); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
.pick-item:hover { border-color: var(--accent); }
.pick-item:has(.pick-radio:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}
.pick-radio { width: 18px; height: 18px; cursor: pointer; }
.pick-thumb {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 8px; overflow: hidden; background: var(--surface-2);
}
.pick-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pick-item .product-code,
.pick-item .product-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Il tasto "vedi foto" sta sopra la miniatura, come lo zoom nella galleria a
   sinistra: appare solo al passaggio del mouse, ed è del tutto assente (non
   solo disabilitato) quando il prodotto non ha ancora foto da mostrare. */
.pick-view {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; cursor: pointer;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.pick-view:hover { background: var(--surface-2); }
.pick-item:hover .pick-view { opacity: 1; pointer-events: auto; }
.pick-view:disabled { display: none; }
/* Fisso in basso a destra, alla stessa quota di "Carica immagini" (in basso a
   sinistra): stessa coppia di azioni primarie della pagina, stesso trattamento,
   invece di lasciare che "Collega" galleggi dove capita in base al contenuto
   della lista. */
.pick-footer {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 40;
  display: flex; align-items: center; gap: .75rem;
}
.selection-count { white-space: nowrap; }

/* ---- Uploader FAB: pulsante fisso in basso a sinistra, pannello che apre in su ---- */
.upload-fab { position: fixed; left: 1.5rem; bottom: 1.5rem; z-index: 40;
  display: flex; align-items: center; gap: .6rem; }
.upload-fab-button {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.2rem; border-radius: 999px;
  background: var(--accent); color: var(--accent-contrast);
  font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
  list-style: none;
}
.upload-fab-button::-webkit-details-marker { display: none; }
.upload-fab-button::before { content: "＋"; font-size: 1.1rem; line-height: 1; }
.upload-fab[open] .upload-fab-button::before,
.import-fab-menu[open] .upload-fab-button::before { content: "×"; }
.upload-fab-row {
  position: absolute; left: 0; bottom: 3.5rem;
  display: flex; align-items: flex-start; gap: .6rem;
}
.upload-fab-panel {
  width: min(24rem, 90vw);
  margin: 0;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.upload-submit { display: none; white-space: nowrap; }
input[type="submit"].upload-confirm { background: var(--ok); color: #fff; }

/* ---- Micro-interazioni: transizioni morbide sugli elementi interattivi ---- */
a, .product-item, .view-icons a, .btn-primary, .btn-ghost,
input[type="submit"], input[type="text"], input[type="password"],
input[type="number"], input[type="datetime-local"], select {
  transition: border-color .15s ease, background-color .15s ease,
              color .15s ease, box-shadow .15s ease, filter .15s ease;
}

/* ---- FAB "aggiungi" (basso a destra nel catalogo) ---- */
.fab {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 40;
}
.fab-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 1.9rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
  list-style: none;              /* nasconde il triangolino del <summary> */
}
.fab-button::-webkit-details-marker { display: none; }
.fab[open] .fab-button { transform: rotate(45deg); }  /* + diventa × */
.fab-menu {
  position: absolute;
  right: 0;
  bottom: 4rem;
  display: flex;
  flex-direction: column;
  min-width: 12rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.fab-menu a,
.fab-menu button {
  padding: .7rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: .95rem;
  white-space: nowrap;
}
.fab-menu button {
  border: 0; background: none; text-align: left; cursor: pointer; font-family: inherit;
}
.fab-menu a:hover,
.fab-menu button:hover { background: var(--surface-2); }

/* "Importa fattura": stesso FAB del caricamento foto (upload-fab-*), ma in basso
   a destra e con il pannello che si allinea a destra. Si nasconde col drawer aperto. */
.import-fab-menu { position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 40;
  display: flex; align-items: center; gap: .6rem; flex-direction: row-reverse; }
.import-fab-menu .upload-fab-row { left: auto; right: 0; }
:root[data-detail="open"] .import-fab-menu { display: none; }

/* Righe fattura: cliccabili, aprono il dettaglio nel drawer. */
.invoice-row { cursor: pointer; }
.invoice-row:hover { background: var(--surface-2); }
.invoice-row.selected { background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* Rispetta chi preferisce meno movimento: niente transizioni né view-transition. */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { transition: none !important; animation: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation: none !important;
  }
}
