/* =====================================================================
   Grafica "Moderno chiaro" – Varolab
   Colori del logo (2026-11-10): giallo #FFC400 e nero #151515.
   --brand è il nero (testi, bordi, fondi con scritta bianca); --giallo è l'accento
   (pulsanti principali, voce attiva del menu, pulsante centrale sul telefono).
   Nel tema scuro --brand diventa il giallo (vedi in fondo).
   ===================================================================== */
:root {
  /* Colori del logo: nero e giallo */
  --brand: #151515;
  --brand-scuro: #000000;
  --brand-chiaro: #fff5d1;
  --su-brand: #ffffff;          /* testo sopra un fondo --brand */
  --giallo: #ffc400;
  --giallo-scuro: #e6ae00;
  --giallo-testo: #7a5a00;      /* giallo leggibile come testo su fondo chiaro */
  --sidebar-bg: #151515;
  --sidebar-testo: #c4c4c4;
  --sfondo: #f3f5f9;
  --bordo: #e3e8ef;
  --raggio: 14px;
  --ombra: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --ombra-alta: 0 8px 24px rgba(16, 24, 40, .10);
  --larghezza-sidebar: 248px;

  --bs-primary: var(--brand);
  --bs-primary-rgb: 21, 21, 21;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 21, 21, 21;
  --bs-link-hover-color: var(--giallo-testo);
  --bs-body-bg: var(--sfondo);
  --bs-border-color: var(--bordo);
  --bs-border-radius: 10px;
  --bs-border-radius-lg: var(--raggio);
  --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Un elemento nascosto resta nascosto anche se ha classi come d-flex (che in Bootstrap vincono sempre) */
[hidden] { display: none !important; }

body { background: var(--sfondo); color: #1d2939; -webkit-font-smoothing: antialiased; }
h1, .h1, h2, .h2, h3, .h3 { font-weight: 700; letter-spacing: -.01em; color: #101828; }

/* --- Pulsanti --- */
.btn { min-height: 2.6rem; border-radius: 10px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { min-height: 2.1rem; border-radius: 8px; }
/* Pulsante principale: giallo del logo con scritta nera */
.btn-primary { --bs-btn-bg: var(--giallo); --bs-btn-border-color: var(--giallo); --bs-btn-color: #151515; --bs-btn-hover-color: #151515; --bs-btn-active-color: #151515; --bs-btn-disabled-color: #151515; --bs-btn-hover-bg: var(--giallo-scuro); --bs-btn-hover-border-color: var(--giallo-scuro); --bs-btn-active-bg: var(--giallo-scuro); --bs-btn-active-border-color: var(--giallo-scuro); --bs-btn-disabled-bg: var(--giallo); --bs-btn-disabled-border-color: var(--giallo); --bs-btn-focus-shadow-rgb: 255, 196, 0; font-weight: 600; }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-hover-color: var(--su-brand); --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand); --bs-btn-active-color: var(--su-brand); }
.form-control, .form-select { min-height: 2.6rem; border-radius: 10px; border-color: #d0d7e2; }
.form-control:focus, .form-select:focus { border-color: var(--giallo-scuro); box-shadow: 0 0 0 .2rem rgba(255, 196, 0, .35); }
.form-check-input:focus { border-color: var(--giallo-scuro); box-shadow: 0 0 0 .2rem rgba(255, 196, 0, .35); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand); }
.nav-pills .nav-link { border-radius: 999px; }
.pagination { --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-color: var(--brand); }

/* --- Schede --- */
.card { --bs-card-bg: #fff; border: 1px solid var(--bordo); border-radius: var(--raggio); box-shadow: var(--ombra); }
.card.shadow-sm { box-shadow: var(--ombra) !important; }
.card-header { background: #fff; border-bottom-color: var(--bordo); border-radius: var(--raggio) var(--raggio) 0 0 !important; }
.card-footer { background: #fafbfc; border-top-color: var(--bordo); }
.list-group-item { border-color: var(--bordo); }
.list-group-item-action:hover { background: #f8fafc; }
a.card { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--ombra-alta); border-color: var(--brand); }
.border-dashed { border-style: dashed !important; box-shadow: none !important; background: transparent; }
.alert { border-radius: 12px; }
.badge { font-weight: 600; }
.breadcrumb { font-size: .9rem; }

/* =====================================================================
   Struttura: menu laterale + barra in alto
   ===================================================================== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--larghezza-sidebar); background: var(--sidebar-bg); color: var(--sidebar-testo);
  display: flex; flex-direction: column;
}
@media (min-width: 992px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1030; }
  .app-main { margin-left: var(--larghezza-sidebar); }
}
.sidebar.offcanvas-lg { --bs-offcanvas-width: 280px; --bs-offcanvas-bg: var(--sidebar-bg); background-color: var(--sidebar-bg) !important; }
.sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 0; overflow-y: auto; height: 100%; }
.sidebar-logo { display: flex; align-items: center; gap: .65rem; padding: 1.25rem 1.25rem 1rem; color: #fff; text-decoration: none; }
.sidebar-logo img { height: 40px; width: auto; max-width: 180px; }
.sidebar-logo .nome { font-weight: 600; font-size: 1.05rem; line-height: 1.1; letter-spacing: .12em; }
.sidebar-logo .nome small { display: block; font-weight: 500; font-size: .75rem; color: var(--sidebar-testo); letter-spacing: .04em; text-transform: uppercase; }
.sidebar-sezione { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6b7a90; padding: 1rem 1.25rem .4rem; }
.sidebar-nav { list-style: none; margin: 0; padding: 0 .75rem; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 10px;
  color: var(--sidebar-testo); text-decoration: none; font-weight: 500;
}
.sidebar-nav a .bi { font-size: 1.15rem; width: 1.25rem; text-align: center; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a.attivo { background: var(--giallo); color: #151515; font-weight: 600; box-shadow: 0 4px 12px rgba(255, 196, 0, .25); }
.sidebar-nav .contatore-rosso { background: #ef4444 !important; color: #fff !important; }
.sidebar-nav .contatore { margin-left: auto; background: #f59e0b; color: #111; border-radius: 999px; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; }
.sidebar-utente { margin-top: auto; padding: 1rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-utente .avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--giallo); color: #151515;
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.sidebar-utente .nome { color: #fff; font-weight: 600; line-height: 1.2; }
.sidebar-utente .ruolo { font-size: .78rem; }
.sidebar-utente a, .sidebar-utente button { color: var(--sidebar-testo); font-size: .85rem; text-decoration: none; background: none; border: 0; padding: 0; }
.sidebar-utente a:hover, .sidebar-utente button:hover { color: #fff; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; background: rgba(243, 245, 249, .85);
  backdrop-filter: saturate(180%) blur(10px); -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--bordo); padding: .75rem 0;
}
.topbar .btn-menu { border: 1px solid var(--bordo); background: #fff; width: 2.6rem; padding: 0; }
/* Telefono: logo al centro in alto, ricerca sulla riga sotto */
.topbar .logo-mobile {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: .5rem;
  text-decoration: none; color: #151515;
}
.topbar .logo-mobile img { height: 34px; }
.topbar .logo-mobile span { font-weight: 700; font-size: 1.15rem; letter-spacing: .18em; }
@media (max-width: 991.98px) {
  .topbar { padding: .55rem 0 .65rem; }
  .barra-ricerca { flex-basis: 100%; max-width: none; }
}
.barra-ricerca { flex: 1 1 auto; max-width: 30rem; position: relative; }
.barra-ricerca .bi-search { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: #98a2b3; }
.barra-ricerca input { padding-left: 2.4rem; background: #fff; border-radius: 999px; }
.contenuto { padding-top: 1.5rem; padding-bottom: 3rem; }

/* Intestazione di pagina */
.titolo-pagina { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.titolo-pagina h1 { margin: 0; font-size: 1.6rem; }
.titolo-pagina .sottotitolo { color: #667085; margin: .15rem 0 0; }

/* =====================================================================
   Home
   ===================================================================== */
.benvenuto {
  background: linear-gradient(135deg, #151515 0%, #2b2b2b 100%); color: #fff; border-bottom: 4px solid var(--giallo);
  border-radius: calc(var(--raggio) + 4px); padding: 1.5rem; box-shadow: var(--ombra-alta); position: relative; overflow: hidden;
}
.benvenuto::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 196, 0, .14); }
.benvenuto h1 { color: #fff; font-size: 1.5rem; margin-bottom: .25rem; }
.benvenuto .ricerca-grande input { border: 0; border-radius: 12px; min-height: 3.1rem; padding-left: 2.8rem; font-size: 1.05rem; }
.benvenuto .ricerca-grande .bi-search { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: #98a2b3; font-size: 1.1rem; }

.statistica { min-width: 0; overflow: hidden; padding: 1.1rem 1.2rem; display: flex; flex-direction: row; align-items: center; gap: 1rem; }
.statistica .icona { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; flex-shrink: 0; }
.statistica .valore { font-size: clamp(1.25rem, 6vw, 1.6rem); font-weight: 700; line-height: 1; color: #101828; }
.statistica .etichetta { color: #667085; font-size: .85rem; margin-top: .2rem; }
.icona-blu { background: var(--brand-chiaro); color: var(--giallo-testo); }
.icona-verde { background: #e7f8ef; color: #12805c; }
.icona-arancio { background: #fff3e0; color: #c4570c; }
.icona-viola { background: #f1ecfe; color: #6941c6; }

.azione-rapida { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; color: inherit; text-decoration: none; }
.azione-rapida .icona { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.azione-rapida .titolo { font-weight: 600; color: #101828; }
.azione-rapida .testo { font-size: .85rem; color: #667085; }
.azione-rapida .bi-chevron-right { margin-left: auto; color: #98a2b3; }

.barra-zona { height: 8px; background: #edf0f5; border-radius: 999px; overflow: hidden; }
.barra-zona > div { height: 100%; background: var(--giallo); border-radius: 999px; }

/* =====================================================================
   Accesso (pagina di login)
   ===================================================================== */
.pagina-accesso {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(255, 196, 0, .16), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(255, 196, 0, .08), transparent 60%), #121212;
}
.scheda-accesso { width: 100%; max-width: 410px; border: 0; border-radius: 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.scheda-accesso .logo-accesso { height: 150px; width: auto; max-width: 220px; }

/* =====================================================================
   Mappa del magazzino: una cella per ripiano
   ===================================================================== */
.scaffale .card-header { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: #f8fafc; }
.cella {
  display: flex; justify-content: space-between; align-items: center;
  padding: .32rem .5rem; border-radius: 8px; font-size: .8rem;
  text-decoration: none; border: 1px solid; transition: transform .1s ease;
}
.cella-libera { color: #12805c; border-color: #b7e4cd; background: #effaf4; }
.cella-occupata { color: var(--su-brand); border-color: var(--brand); background: var(--brand); }
.cella:hover { transform: scale(1.04); filter: brightness(.97); }

/* Stato "Da riparare" */
.text-bg-orange { color: #fff; background-color: #f97316; }

/* Foto */
.miniatura { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.miniatura-vuota { display: flex; align-items: center; justify-content: center; background: #eef2f7; color: #98a2b3; font-size: 1.4rem; }
.foto-griglia { aspect-ratio: 1; object-fit: cover; }
.min-w-0 { min-width: 0; }

/* Lista di prelievo */
.codice-prelievo { min-width: 7.5rem; }
.casella-stampa { display: none; font-size: 1.5rem; }
@media print {
  .sidebar, .topbar, .no-stampa, .alert, .btn-close { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .casella-stampa { display: inline; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; }
  .codice-prelievo { color: #000 !important; background: none !important; border: 1px solid #000; }
}

/* =====================================================================
   Etichette da stampare (fogli A4): solo codici, scritti in grande
   ===================================================================== */
.anteprima-fogli { overflow-x: auto; padding-bottom: 1rem; }
.foglio {
  width: 210mm; height: 297mm; background: #fff; margin: 0 auto 1.5rem; box-shadow: var(--ombra-alta);
  display: grid; align-content: start; overflow: hidden;
}
.foglio-piccole { grid-template-columns: repeat(3, 70mm); grid-auto-rows: 37mm; }
.foglio-striscia { grid-template-columns: repeat(3, 70mm); grid-auto-rows: 20mm; padding-top: 8.5mm; }
.foglio-grandi { grid-template-columns: repeat(2, 105mm); grid-auto-rows: 74mm; }
.foglio-extra { grid-template-columns: 210mm; grid-auto-rows: 148.5mm; }
.foglio .etichetta {
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 3mm 4mm; overflow: hidden; outline: 1px dashed #b8c0cc; outline-offset: -1px; color: #000;
}
.foglio .etichetta .testo { min-width: 0; max-width: 100%; line-height: 1.1; }
.foglio .etichetta .titolo { font-weight: 700; overflow-wrap: anywhere; }
.foglio .etichetta-posizione .titolo { font-family: ui-monospace, Menlo, monospace; white-space: nowrap; letter-spacing: -.02em; }
.foglio .etichetta .riga1 { font-weight: 600; }
.foglio .etichetta .riga2 { color: #333; }
/* Etichetta con QR (solo su richiesta, per un singolo articolo) */
.foglio .etichetta.con-qr { justify-content: flex-start; text-align: left; gap: 3mm; }
.foglio .etichetta .qr { flex-shrink: 0; }
.foglio .etichetta .qr svg { display: block; width: 100%; height: 100%; }
.foglio-piccole .qr { width: 29mm; height: 29mm; }
.foglio-grandi .qr { width: 55mm; height: 55mm; }
.foglio-extra .qr { width: 110mm; height: 110mm; }

.foglio-piccole .titolo { font-size: 13pt; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.foglio-piccole .etichetta-posizione .titolo { font-size: 20pt; }
.foglio-piccole .riga1 { font-size: 9pt; margin-top: 1.5mm; }
.foglio-piccole .riga2 { font-size: 8pt; margin-top: .5mm; }

.foglio-grandi .titolo { font-size: 20pt; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.foglio-grandi .etichetta-posizione .titolo { font-size: 32pt; }
.foglio-grandi .riga1 { font-size: 13pt; margin-top: 3mm; }
.foglio-grandi .riga2 { font-size: 12pt; margin-top: 1mm; }

/* Strisce alte 2 cm per il bordo dei ripiani: solo "S3 · R2" */
.foglio-striscia .etichetta { padding: 1mm 2mm; }
.foglio-striscia .titolo { font-size: 30pt; line-height: 1; }

.foglio-extra .titolo { font-size: 40pt; }
.foglio-extra .etichetta-posizione .titolo { font-size: 72pt; }
.foglio-extra .riga1 { font-size: 22pt; margin-top: 6mm; }
.foglio-extra .riga2 { font-size: 18pt; margin-top: 2mm; }

@media print {
  @page { size: A4; margin: 0; }
  .contenuto { padding: 0 !important; max-width: none !important; }
  .anteprima-fogli { overflow: visible; padding: 0; }
  .foglio { margin: 0; box-shadow: none; break-after: page; page-break-after: always; }
  .foglio:last-child { break-after: auto; page-break-after: auto; }
}

/* =====================================================================
   Barra in basso (telefono)
   ===================================================================== */
@media (max-width: 991.98px) {
  /* Spazio sotto la pagina per la barra in basso: almeno 5,5rem, o quanto è alta davvero la barra su quel telefono
     (--spazio-barra, misurata in base.html; utente 2026-10-26: "mi copre l'ultima parte della pagina") */
  .contenuto { padding-bottom: max(calc(5.5rem + env(safe-area-inset-bottom)), var(--spazio-barra, 0px)); }
  .topbar .btn-menu { display: none; }  /* il menu si apre dalla barra in basso */
}
.barra-basso {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; transform: translateZ(0);
  display: flex; justify-content: space-around; align-items: flex-end;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--bordo);
  padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
}
.barra-basso a, .barra-basso button {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem;
  color: #667085; text-decoration: none; font-size: .68rem; font-weight: 500;
  background: none; border: 0; padding: .2rem 0; min-height: 3rem; justify-content: center;
}
.barra-basso .bi { font-size: 1.35rem; line-height: 1; }
.barra-basso .attivo { color: var(--brand); font-weight: 700; }
.barra-basso .centrale {
  flex: 0 0 auto; width: 3.4rem; height: 3.4rem; min-height: 0; margin: -1.4rem .4rem 0;
  border-radius: 50%; background: var(--giallo); color: #151515; box-shadow: 0 6px 16px rgba(255, 196, 0, .45);
}
.barra-basso .centrale .bi { font-size: 1.6rem; }
.barra-basso .centrale.attivo { color: #151515; background: var(--giallo-scuro); }
.barra-basso .pallino {
  position: absolute; top: 0; left: 55%; min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem;
  border-radius: 999px; background: #ef4444; color: #fff; font-size: .65rem; line-height: 1.1rem; text-align: center;
}
@media print { .barra-basso { display: none !important; } }

/* Planimetria */
.contenitore-pianta { background: #fbfcfd; border-radius: 8px; overflow: hidden; }
.contenitore-pianta svg { display: block; width: 100%; height: auto; aspect-ratio: var(--proporzione, 4 / 3);
  min-height: 240px; max-height: min(75vh, 720px); user-select: none; -webkit-user-select: none; }
@keyframes pulsa { 0%, 100% { opacity: .55; } 50% { opacity: .15; } }
.alone-pianta { animation: pulsa 1.2s ease-in-out infinite; }

/* =====================================================================
   Telefono (iPhone): tutto più compatto per vedere più contenuto
   ===================================================================== */
@media (max-width: 991.98px) {
  /* Logo piccolo e ricerca sulla stessa riga */
  .topbar .logo-mobile.con-ricerca { width: auto; flex: 0 0 auto; }
  .topbar .logo-mobile.con-ricerca img { height: 30px; }
  .topbar .logo-mobile.con-ricerca span { display: none; }
  .topbar .container-xl { flex-wrap: nowrap !important; }
  .barra-ricerca { flex: 1 1 auto; flex-basis: auto; min-width: 0; }
}
@media (max-width: 767.98px) {
  .container-xl { --bs-gutter-x: 1.5rem; }
  .contenuto { padding-top: .9rem; }
  .topbar { padding: .45rem 0; }
  /* Titoli e descrizioni */
  .titolo-pagina { gap: .5rem; margin-bottom: .85rem; }
  .titolo-pagina h1 { font-size: 1.35rem; }
  .titolo-pagina .sottotitolo { font-size: .85rem; line-height: 1.35; }
  h2.h5, .h5 { font-size: 1.05rem; }
  .breadcrumb { margin-bottom: .5rem; }
  /* Schede e righe meno imbottite */
  .card { --bs-card-spacer-y: .85rem; --bs-card-spacer-x: .85rem; --bs-card-cap-padding-y: .6rem; --bs-card-cap-padding-x: .85rem; }
  .list-group { --bs-list-group-item-padding-x: .8rem; --bs-list-group-item-padding-y: .65rem; }
  .mb-4 { margin-bottom: 1.1rem !important; }
  .row.g-3 { --bs-gutter-x: .6rem; --bs-gutter-y: .6rem; }
  /* Riquadri con i numeri: piccoli, due per riga */
  .statistica { padding: .65rem .75rem; gap: .6rem; }
  .statistica .icona { width: 36px; height: 36px; border-radius: 10px; font-size: 1.05rem; }
  .statistica .valore { font-size: 1.25rem; }
  .statistica .etichetta { font-size: .74rem; line-height: 1.2; margin-top: .15rem; }
  .benvenuto { padding: 1.1rem !important; }
  .benvenuto h1 { font-size: 1.25rem; }
  /* Pulsanti comodi da toccare col dito */
  .btn-sm { min-height: 2.5rem; min-width: 2.5rem; }
  /* L'iPhone ingrandisce la pagina se un campo ha il testo sotto i 16 px: li teniamo a 16 */
  .form-control, .form-select, .form-control-sm, .form-select-sm { font-size: 16px; }
  .form-control-sm, .form-select-sm { min-height: 2.5rem; }
  /* Linguette (es. "Da fare / Fatti", zone) su una riga che scorre */
  .nav-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav-pills::-webkit-scrollbar { display: none; }
  .nav-pills .nav-link { white-space: nowrap; }
  /* Righe con nome + comandi: il nome sopra, i comandi tutti sulla riga sotto */
  .riga-comandi .nome-riga { flex-basis: 100%; }
  .riga-comandi .campo-mese { width: 8.2rem !important; }
}
.min-w-0 { min-width: 0; }

/* Semaforo "Pronta per il varo?" */
.semaforo { display: inline-block; width: .9rem; height: .9rem; border-radius: 50%; flex-shrink: 0; margin-top: .3rem;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .05); }
.semaforo-grande { width: 1.6rem; height: 1.6rem; margin-top: 0; }
.semaforo-rosso { background: #dc2626; }
.semaforo-giallo { background: #f59e0b; }
.semaforo-verde { background: #16a34a; }

/* Calendario del cantiere */
.calendario { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-testa { text-align: center; font-size: .72rem; font-weight: 600; color: #667085; text-transform: uppercase; padding: .2rem 0; }
.cal-giorno { display: flex; flex-direction: column; align-items: center; min-height: 3.1rem; padding: .25rem .15rem;
  border-radius: 8px; background: #f8fafc; color: #1d2939; text-decoration: none; font-size: .9rem; }
.cal-giorno.fuori { opacity: .35; }
.cal-giorno.con-eventi { background: #eef4f8; }
.cal-giorno.oggi { outline: 2px solid var(--brand); font-weight: 700; }
.cal-giorno .puntini { display: flex; gap: 2px; margin-top: .15rem; }
.cal-giorno .puntino { width: 6px; height: 6px; border-radius: 50%; }
.cal-giorno .anteprima { width: 100%; font-size: .7rem; line-height: 1.25; margin-top: .2rem; }
@media (min-width: 992px) { .cal-giorno { min-height: 5.5rem; align-items: stretch; } .cal-giorno .numero { text-align: right; } }

/* =====================================================================
   Scheda della barca: cruscotto
   ===================================================================== */
.barca-hero {
  position: relative; overflow: hidden; border-radius: 18px; padding: 1.4rem 1.5rem; color: #fff;
  background: linear-gradient(135deg, #0d0d0d 0%, #151515 55%, #2e2e2e 100%); border-bottom: 4px solid var(--giallo);
  box-shadow: var(--ombra-alta);
}
.barca-hero::after {  /* onda decorativa */
  content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 196, 0, .10); pointer-events: none;
}
.barca-hero h1 { color: #fff; font-size: 1.9rem; line-height: 1.1; }
.barca-hero-icona { width: 3.2rem; height: 3.2rem; border-radius: 14px; background: rgba(255, 255, 255, .15);
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem; flex-shrink: 0; }
.barca-hero-foto { width: 4.6rem; height: 4.6rem; border-radius: 14px; overflow: hidden; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, .5); }
.barca-hero-foto img { width: 100%; height: 100%; object-fit: cover; }
.foto-barca-mini { width: 2.6rem; height: 2.6rem; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.barca-hero .pillola { background: rgba(255, 255, 255, .15); border-radius: 999px; padding: .15rem .65rem; font-size: .85rem; }
.stato-varo { position: relative; z-index: 1; display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border-radius: 12px;
  background: #fff; color: #1d2939; text-decoration: none; }
.stato-varo .semaforo { margin-top: 0; }
.stato-varo-rosso { box-shadow: inset 4px 0 0 #dc2626; }
.stato-varo-giallo { box-shadow: inset 4px 0 0 #f59e0b; }
.stato-varo-verde { box-shadow: inset 4px 0 0 #16a34a; }
.stato-varo-mare { box-shadow: inset 4px 0 0 #38bdf8; }
/* Tutti i pulsanti visibili, su più righe (utente 2026-10-23: sul telefono la striscia usciva dallo schermo) */
.azioni-hero { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .4rem; }
.azioni-hero > form { display: contents; }
.azioni-hero > form.acqua-scelta, .azioni-hero > form.btn-group { display: inline-flex; }
@media (max-width: 575.98px) {
  .azioni-hero .btn { min-height: 2.2rem; padding: .25rem .6rem; font-size: .82rem; }
}
.azioni-hero::-webkit-scrollbar { display: none; }
.azioni-hero .btn { white-space: nowrap; flex-shrink: 0; }
.azioni-hero .btn-outline-light { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255, 255, 255, .6); }
.azioni-hero .acqua-scelta .btn-outline-secondary { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255, 255, 255, .6); }

.griglia-riquadri { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .75rem; }
.riquadro { display: flex; flex-direction: column; gap: .05rem; padding: .85rem .95rem; border-radius: var(--raggio);
  background: #fff; border: 1px solid var(--bordo); box-shadow: var(--ombra); color: #1d2939; text-decoration: none;
  border-top: 4px solid #cbd5e1; transition: transform .15s ease, box-shadow .15s ease; min-width: 0; }
.riquadro:hover { transform: translateY(-2px); box-shadow: var(--ombra-alta); color: #1d2939; }
.riquadro > .bi { font-size: 1.25rem; color: #667085; }
.riquadro .numero { font-size: 1.6rem; font-weight: 700; line-height: 1.15; margin-top: .2rem; }
.riquadro .numero-piccolo { font-size: 1.1rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.riquadro .nome { font-weight: 600; font-size: .9rem; }
.riquadro .nota { font-size: .76rem; color: #667085; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.riquadro-rosso { border-top-color: #dc2626; background: #fef2f2; } .riquadro-rosso > .bi { color: #dc2626; }
.riquadro-giallo { border-top-color: #f59e0b; background: #fffbeb; } .riquadro-giallo > .bi { color: #d97706; }
.riquadro-verde { border-top-color: #16a34a; } .riquadro-verde > .bi { color: #16a34a; }
.riquadro-blu { border-top-color: var(--giallo); } .riquadro-blu > .bi { color: var(--giallo-testo); }
@media (max-width: 767.98px) {
  .barca-hero { padding: 1.05rem; border-radius: 16px; }
  .barca-hero h1 { font-size: 1.45rem; }
  .barca-hero-icona { width: 2.6rem; height: 2.6rem; font-size: 1.35rem; }
  .griglia-riquadri { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .riquadro { padding: .65rem .7rem; }
  .riquadro .numero { font-size: 1.35rem; }
}

/* Rimessaggio: campione della barca "ancora a mare" nella legenda */
.campione-onde { display: inline-block; width: 1.6rem; height: .8rem; vertical-align: -.1rem; border: 1.5px dotted #0369a1;
  border-radius: .4rem; background: repeating-radial-gradient(circle at 50% 140%, #f0f9ff 0 .25rem, #7dd3fc .25rem .32rem); }

/* Elenco barche: righe compatte (foto o tipologia colorata, nome, dettagli, stato a mare/alata, menu ⋮) */
.riga-barca { display: flex; align-items: center; gap: .7rem; padding: .7rem .85rem; }
.riga-barca-foto { width: 2.8rem; height: 2.8rem; border-radius: 12px; flex-shrink: 0; overflow: hidden; display: flex;
  align-items: center; justify-content: center; font-size: 1.3rem; background: var(--tip, #e2e8f0); color: var(--tip-scuro, #475569); }
.riga-barca-foto img { width: 100%; height: 100%; object-fit: cover; }
.riga-barca-nome { display: block; font-weight: 600; font-size: 1.02rem; line-height: 1.25; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.riga-barca-info { font-size: .8rem; line-height: 1.3; color: var(--bs-secondary-color); }
.riga-barca-menu { width: 2.1rem; padding-left: 0; padding-right: 0; }
.chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; line-height: 1.3; padding: .1rem .5rem;
  border-radius: 999px; background: #eef2f6; color: #334155; white-space: nowrap; }
.chip-data { background: #fff7ed; color: #9a3412; }
.stato-acqua-btn { border-radius: 999px; font-size: .78rem; font-weight: 600; padding: .3rem .65rem; border: 1.5px solid;
  white-space: nowrap; line-height: 1.2; }
.stato-mare { background: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.stato-alata { background: #dcfce7; color: #15803d; border-color: #86efac; }
.tip-gozzo { --tip: #fde68a; --tip-scuro: #b45309; } .tip-lancia { --tip: #fed7aa; --tip-scuro: #9a3412; }
.tip-gommone { --tip: #ddd6fe; --tip-scuro: #6d28d9; } .tip-motoscafo { --tip: #bae6fd; --tip-scuro: #0369a1; }
.tip-scheggia { --tip: #bbf7d0; --tip-scuro: #15803d; } .tip-tender { --tip: #fbcfe8; --tip-scuro: #be185d; }
.tip-caicco { --tip: #99f6e4; --tip-scuro: #0f766e; }

/* Scelta di più articoli (cambio categoria): la barra resta in alto mentre si scorre */
.barra-scelta { top: 4.2rem; z-index: 5; }
.riga-scelta { cursor: pointer; }

/* Lista lavori: una tendina per barca */
.tendina-barca > summary { cursor: pointer; list-style: none; }
.tendina-barca > summary::-webkit-details-marker { display: none; }
.tendina-barca .freccia-tendina { transition: transform .15s; }
.tendina-barca[open] .freccia-tendina { transform: rotate(90deg); }
.tendina-barca:not([open]) > summary { border-bottom: 0; border-radius: var(--bs-card-inner-border-radius); }

/* Lista lavori: tendina "Chi lo fa" (caselle dei lavoratori) */
.menu-assegna { min-width: 15rem; max-height: 60vh; overflow-y: auto; }
.menu-assegna .dropdown-item { white-space: normal; }

/* Registro presenze: tabella (prima colonna fissa, una casella per giorno) */
.tabella-riposi { overflow-x: auto; }
.tabella-riposi table { border-collapse: separate; border-spacing: 0; }
.tabella-riposi .nome-riga { position: sticky; left: 0; z-index: 2; background: var(--bs-body-bg); min-width: 9.5rem; max-width: 11rem;
  border-right: 1px solid var(--bs-border-color); }
.tabella-riposi tr.gruppo td { background: var(--bs-tertiary-bg); padding-top: .35rem; }
.tabella-riposi .giorno-col { min-width: 2.2rem; font-size: .8rem; line-height: 1.1; }
.tabella-riposi th.oggi { box-shadow: inset 0 -3px 0 var(--giallo); }
.tabella-riposi .festa { background: #fef2f2; }
.tabella-riposi .domenica { background: #f8fafc; }
.giorno { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; margin: 1px;
  border-radius: 7px; border: 0; font-size: .72rem; font-weight: 700; color: #94a3b8; background: transparent; }
.giorno.g-riposo { background: #dcfce7; color: #15803d; }
.giorno.g-festivo { background: #ede9fe; color: #6d28d9; }
.giorno.g-ferie { background: #dbeafe; color: #1d4ed8; }
.giorno.g-malattia { background: #fee2e2; color: #b91c1c; }
.giorno.g-lavoro { background: #f1f5f9; color: #475569; }
.giorno.g-festa-col { background: #fef2f2; }
button.giorno:not(:disabled):hover { outline: 2px solid #94a3b8; }
.legenda-giorni .giorno { width: 1.6rem; height: 1.4rem; }
.menu-giorno { position: absolute; z-index: 1060; width: 14rem; }

.elenco-spunte { max-height: 15rem; overflow-y: auto; }
.elenco-spunte label { cursor: pointer; }
.elenco-spunte label:hover { background: var(--bs-tertiary-bg); }
.giorno.g-festa { background: #fce7f3; color: #be185d; }
.giorno.g-permesso { background: #fef9c3; color: #a16207; }
.giorno.auto { opacity: .55; font-weight: 600; }
.giorno.g-permesso_ore { background: #fef3c7; color: #b45309; font-size: .62rem; }

/* Scelta dell'area all'apertura: Magazzino, Cantiere, Ufficio */
.scelta-area { max-width: 62rem; margin: 2rem auto; }
.area-riquadro { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; padding: 1.8rem 1.6rem; border-radius: 20px;
  text-decoration: none; color: #fff; min-height: 13rem; box-shadow: 0 10px 30px -12px rgba(15,23,42,.45); transition: transform .15s; }
.area-riquadro:hover, .area-riquadro:focus { transform: translateY(-3px); color: #fff; }
.area-riquadro i { font-size: 2.6rem; opacity: .9; }
.area-riquadro .titolo { font-size: 1.6rem; font-weight: 800; line-height: 1.15; }
.area-riquadro .testo { font-size: .95rem; opacity: .85; }
.area-magazzino { background: linear-gradient(135deg, #2e2e2e, #0d0d0d); border-bottom: 5px solid var(--giallo); }
@media (max-width: 575px) { .scelta-area { margin: .5rem auto; } .area-riquadro { min-height: 9.5rem; padding: 1.3rem; } .area-riquadro .titolo { font-size: 1.35rem; } }
.cambia-area { display: flex; align-items: center; gap: .5rem; margin: .4rem .75rem .2rem; padding: .5rem .75rem; border-radius: 10px;
  background: rgba(255, 196, 0, .14); color: #ffd84d; text-decoration: none; font-size: .88rem; font-weight: 600; }
.cambia-area:hover { background: rgba(255, 196, 0, .26); color: #fff; }
.area-cantiere { background: linear-gradient(135deg, #ffd23f, #ffc400 55%, #e6ae00); color: #151515; }
.area-cantiere:hover, .area-cantiere:focus { color: #151515; }
.cambia-area .small { font-weight: 500; }
.giorno.g-cantiere { background: #ffedd5; color: #c2410c; }
.area-ufficio { background: linear-gradient(135deg, #5a5a5a, #2e2e2e); border-bottom: 5px solid var(--giallo); }

/* Utenti: schede con iniziali e aree da accendere con un tocco */
.avatar-utente { flex-shrink: 0; width: 3rem; height: 3rem; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 1.05rem; color: #fff; }
.avatar-utente.piccolo { width: 2rem; height: 2rem; font-size: 1rem; }
.av-rosso { background: #dc2626; } .av-blu { background: #151515; } .av-verde { background: #16a34a; }
.av-arancio { background: #ea580c; } .av-viola { background: #7c3aed; } .av-grigio { background: #94a3b8; }
.scheda-utente { transition: box-shadow .15s; }
.scheda-utente:hover { box-shadow: 0 6px 18px -10px rgba(15,23,42,.35); }
.chip-area { border: 1px dashed var(--bs-border-color); background: transparent; color: var(--bs-secondary-color);
  border-radius: 999px; padding: .2rem .65rem; font-size: .82rem; font-weight: 600; }
.chip-area.acceso { border-style: solid; color: #fff; }
.chip-area.acceso.chip-magazzino { background: #151515; border-color: #151515; }
.chip-area.acceso.chip-cantiere { background: #ffc400; border-color: #ffc400; color: #151515; }
.chip-area.acceso.chip-ufficio { background: #4a4a4a; border-color: #4a4a4a; }
.chip-area:disabled { opacity: .6; }
/* Modulo utente: ruoli e aree come riquadri da scegliere */
.scelta-riquadro { display: block; cursor: pointer; border: 2px solid var(--bs-border-color); border-radius: 14px; padding: .7rem .9rem; height: 100%; }
.scelta-riquadro:hover { border-color: var(--brand); }
.scelta-riquadro input { position: absolute; opacity: 0; pointer-events: none; }
.scelta-riquadro:has(input:checked) { border-color: var(--brand); background: var(--brand-chiaro); }
.scelta-riquadro:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.scelta-riquadro .titolo { font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.scelta-riquadro .spunta { margin-left: auto; color: var(--brand); visibility: hidden; }
.scelta-riquadro:has(input:checked) .spunta { visibility: visible; }

/* Presenze: segna veloce, più giorni insieme, calendario della persona */
.pennelli .btn { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .45rem; }
.pennelli .btn .giorno { width: 1.6rem; height: 1.4rem; margin: 0; }
.pennelli .btn.active { background: var(--brand-chiaro); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.con-pennello button.giorno { cursor: crosshair; }
.riga-attiva td, .riga-attiva td.nome-riga { background: #fefce8 !important; }
th.col-attiva { background: #fde68a !important; }
button.giorno.selezionata { outline: 3px solid var(--brand); }
button.giorno.in-salvataggio { opacity: .35; }
.riassunto { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.riassunto .badge { font-weight: 600; }
.tabella-riposi .nome-riga a:hover { text-decoration: underline !important; }
.cal-griglia { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-testa { text-align: center; font-size: .75rem; color: var(--bs-secondary-color); font-weight: 600; }
.cal-giorno { border: 1px solid var(--bs-border-color); border-radius: 10px; padding: 2px; display: flex; flex-direction: column; align-items: center; }
.cal-giorno.domenica { background: #f8fafc; } .cal-giorno.festa { background: #fef2f2; }
.cal-giorno.oggi { border: 2px solid var(--brand); }
.cal-num { font-size: .75rem; color: var(--bs-secondary-color); align-self: flex-start; padding-left: 4px; }
.cal-giorno .giorno { width: 100%; height: 2.6rem; font-size: 1rem; font-weight: 700; }
.badge.g-riposo { background: #dcfce7; color: #15803d; } .badge.g-festa { background: #fce7f3; color: #be185d; }
.badge.g-ferie { background: #dbeafe; color: #1d4ed8; } .badge.g-malattia { background: #fee2e2; color: #b91c1c; }
.badge.g-permesso { background: #fef9c3; color: #a16207; } .badge.g-permesso_ore { background: #fef3c7; color: #b45309; }
.badge.g-cantiere { background: #ffedd5; color: #c2410c; }
/* Linguette dei tre registri presenze */
.registro-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; border-radius: 12px; flex-shrink: 0;
  border: 2px solid var(--bs-border-color); background: var(--bs-body-bg); color: var(--bs-body-color); text-decoration: none; font-weight: 600; }
.registro-tab:hover { border-color: var(--brand); color: var(--brand); }
.registro-tab.attivo { background: var(--brand); border-color: var(--brand); color: var(--su-brand); }
.registro-tab i { font-size: 1.1rem; }
/* Chi lavora */
.stato-chi { display: inline-flex; align-items: center; gap: .2rem; padding: .2rem .55rem; border-radius: 999px; font-size: .82rem; white-space: nowrap; }
.stato-chi.g-lavoro { background: #f0fdf4; color: #15803d; }
.stato-chi.g-riposo { background: #dcfce7; color: #15803d; } .stato-chi.g-festa { background: #fce7f3; color: #be185d; }
.stato-chi.g-festivo { background: #ede9fe; color: #6d28d9; } .stato-chi.g-ferie { background: #dbeafe; color: #1d4ed8; }
.stato-chi.g-malattia { background: #fee2e2; color: #b91c1c; } .stato-chi.g-permesso { background: #fef9c3; color: #a16207; }
.stato-chi.g-permesso_ore { background: #fef3c7; color: #b45309; } .stato-chi.g-cantiere { background: #ffedd5; color: #c2410c; }
.stato-chi.assente { font-weight: 600; outline: 1px solid currentColor; }
.tabella-chi th.oggi { background: var(--brand-chiaro); }
.badge.g-lavoro { background: #f0fdf4; color: #15803d; } .badge.g-festivo { background: #ede9fe; color: #6d28d9; }
/* Guida */
.voce-guida summary { cursor: pointer; list-style: none; }
.voce-guida summary::-webkit-details-marker { display: none; }
.voce-guida[open] .freccia-tendina { transform: rotate(90deg); }
.passi-guida li { margin-bottom: .45rem; line-height: 1.45; }
.passi-guida { padding-left: 2.4rem; padding-right: 1rem; }
.qr-doppio svg { width: 220px; height: 220px; background: #fff; padding: 6px; border-radius: 8px; }
.pallino-online { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }

/* Alaggi: "Da riprogrammare" come piccolo menu sulla riga */
.dropdown-riprogramma { position: relative; }
.dropdown-riprogramma > summary { list-style: none; }
.dropdown-riprogramma > summary::-webkit-details-marker { display: none; }

/* Riquadro "Oggi" in cima alle Home */
.riquadro-oggi { border: 0; border-left: 4px solid var(--giallo); }
.riquadro-oggi .titolo-oggi { font-weight: 700; margin-right: .25rem; }
.voce-oggi { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .3rem .75rem; font-size: .875rem;
  font-weight: 500; text-decoration: none; border: 1px solid transparent; }
.voce-oggi.rossa { background: #fdecec; color: #a61b1b; border-color: #f6c9c9; }
.voce-oggi.gialla { background: #fff6dd; color: #7a5a00; border-color: #f3dd9b; }
.voce-oggi.blu { background: #eef1f5; color: #2b3a4a; border-color: #d3dae3; }
.voce-oggi.verde { background: #e9f7ef; color: #1e6b3d; border-color: #c4e7d1; }
a.voce-oggi:hover { filter: brightness(.96); }
.riquadro-oggi a.voce-oggi ~ .tutto-ok { display: none; }

/* =====================================================================
   Modalità scura (automatica con l'iPhone/computer, oppure scelta nel menu utente → Tema)
   Le piante e i fogli da stampare restano chiari, come la carta.
   ===================================================================== */
[data-bs-theme="dark"] {
  --sfondo: #111111; --bordo: #2a2a2a; --brand-chiaro: #2a2410;
  --brand: #ffc400; --brand-scuro: #e6ae00; --su-brand: #151515; --giallo-testo: #ffd84d;
  --ombra: 0 1px 2px rgba(0, 0, 0, .35); --ombra-alta: 0 8px 24px rgba(0, 0, 0, .45);
  --bs-body-bg: var(--sfondo); --bs-body-color: #dedede; --bs-border-color: var(--bordo);
  --bs-primary-rgb: 255, 196, 0;
  --bs-link-color: #ffd84d; --bs-link-color-rgb: 255, 216, 77; --bs-link-hover-color: #ffe999;
  --bs-secondary-color: #a3a3a3; --bs-tertiary-bg: #1a1a1a;
  color-scheme: dark;
}
[data-bs-theme="dark"] body { color: #dedede; }
[data-bs-theme="dark"] h1, [data-bs-theme="dark"] .h1, [data-bs-theme="dark"] h2, [data-bs-theme="dark"] .h2,
[data-bs-theme="dark"] h3, [data-bs-theme="dark"] .h3 { color: #f2f2f2; }
[data-bs-theme="dark"] .card { --bs-card-bg: #1a1a1a; }
[data-bs-theme="dark"] .card-header { background: #1a1a1a; }
[data-bs-theme="dark"] .card-footer, [data-bs-theme="dark"] .scaffale .card-header { background: #151515; }
[data-bs-theme="dark"] .list-group { --bs-list-group-bg: #1a1a1a; }
[data-bs-theme="dark"] .list-group-item-action:hover { background: #222222; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { border-color: #3a3a3a; background-color: #141414; }
[data-bs-theme="dark"] .topbar { background: rgba(17, 17, 17, .92); border-color: var(--bordo); }
[data-bs-theme="dark"] .topbar .btn-menu, [data-bs-theme="dark"] .barra-ricerca input { background: #1a1a1a; }
[data-bs-theme="dark"] .logo-mobile { color: #f2f2f2; }
[data-bs-theme="dark"] .titolo-pagina .sottotitolo, [data-bs-theme="dark"] .statistica .etichetta,
[data-bs-theme="dark"] .azione-rapida .testo, [data-bs-theme="dark"] .riquadro .nota, [data-bs-theme="dark"] .cal-testa { color: #a3a3a3; }
[data-bs-theme="dark"] .statistica .valore, [data-bs-theme="dark"] .azione-rapida .titolo { color: #f2f2f2; }
[data-bs-theme="dark"] .icona-verde { background: #12301f; color: #6ee7a8; }
[data-bs-theme="dark"] .icona-arancio { background: #3a2410; color: #fdba74; }
[data-bs-theme="dark"] .icona-viola { background: #2a1f45; color: #c4b5fd; }
[data-bs-theme="dark"] .barra-zona, [data-bs-theme="dark"] .miniatura-vuota { background: #262626; }
[data-bs-theme="dark"] .cella-libera { background: #10261a; border-color: #1f5136; color: #6ee7a8; }
[data-bs-theme="dark"] .riquadro, [data-bs-theme="dark"] .azioni-hero .btn-light { background: #1a1a1a; color: #dedede; }
[data-bs-theme="dark"] .riquadro:hover { color: #f2f2f2; }
[data-bs-theme="dark"] .riquadro-rosso { background: #2a1416; } [data-bs-theme="dark"] .riquadro-giallo { background: #2a2212; }
[data-bs-theme="dark"] .cal-giorno { background: #1a1a1a; color: #dedede; }
[data-bs-theme="dark"] .cal-giorno.con-eventi { background: #2a2410; }
[data-bs-theme="dark"] .cal-giorno.domenica, [data-bs-theme="dark"] .tabella-riposi .domenica { background: #161616; }
[data-bs-theme="dark"] .cal-giorno.festa, [data-bs-theme="dark"] .tabella-riposi .festa, [data-bs-theme="dark"] .giorno.g-festa-col { background: #2a1416; }
[data-bs-theme="dark"] .giorno.g-lavoro { background: #222222; color: #a3a3a3; }
[data-bs-theme="dark"] .chip { background: #262626; color: #cfcfcf; }
[data-bs-theme="dark"] .riga-attiva td, [data-bs-theme="dark"] .riga-attiva td.nome-riga { background: #2a2712 !important; }
[data-bs-theme="dark"] .barra-basso { background: rgba(17, 17, 17, .96); border-color: var(--bordo); }
[data-bs-theme="dark"] .barra-basso a, [data-bs-theme="dark"] .barra-basso button { color: #a3a3a3; }
[data-bs-theme="dark"] .riquadro-oggi { background: #1a1a1a; }
[data-bs-theme="dark"] .voce-oggi.rossa { background: #2f1517; color: #fca5a5; border-color: #5b2226; }
[data-bs-theme="dark"] .voce-oggi.gialla { background: #2d2512; color: #fcd77a; border-color: #5a4a1d; }
[data-bs-theme="dark"] .voce-oggi.blu { background: #1f1f1f; color: #cfcfcf; border-color: #3a3a3a; }
[data-bs-theme="dark"] .voce-oggi.verde { background: #11281b; color: #86efac; border-color: #1f5136; }
[data-bs-theme="dark"] .btn-light { --bs-btn-bg: #262626; --bs-btn-border-color: #333333; --bs-btn-color: #dedede;
  --bs-btn-hover-bg: #26313a; --bs-btn-hover-color: #fff; }
/* Le piante restano chiare (sono disegni) */
[data-bs-theme="dark"] .contenitore-pianta { background: #f2f2f2; }

/* Galleria della barca */
.galleria-barca { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.foto-galleria { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: 10px;
  overflow: hidden; background: #e5e9ee; cursor: zoom-in; }
.foto-galleria img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.foto-galleria:hover img { transform: scale(1.04); }
.foto-galleria.principale { outline: 3px solid var(--brand); outline-offset: -3px; }
.etichetta-foto { position: absolute; left: .4rem; bottom: .4rem; background: rgba(15, 23, 42, .72); color: #fff; font-size: .72rem;
  font-weight: 600; border-radius: 6px; padding: .05rem .45rem; }
.foto-galleria-box { position: relative; }
.azioni-foto { position: absolute; top: .3rem; right: .3rem; display: flex; gap: .25rem; }
.azioni-foto .btn { min-height: 1.9rem; padding: 0 .45rem; opacity: .92; }

/* Lista lavori a colonne (computer e tablet) */
.lavagna { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; align-items: start; }
@media (max-width: 767.98px) { .lavagna { grid-template-columns: 1fr; } }
.colonna-lavori { background: var(--brand-chiaro); border-radius: var(--raggio); padding: .6rem; min-height: 12rem; transition: box-shadow .15s; }
.colonna-lavori.sopra { box-shadow: inset 0 0 0 2px var(--brand); }
.colonna-lavori header { display: flex; align-items: center; gap: .45rem; font-weight: 700; padding: .2rem .3rem .6rem; }
.pallino-stato { width: .65rem; height: .65rem; border-radius: 50%; }
.pallino-stato.stato-da_fare { background: #94a3b8; } .pallino-stato.stato-in_corso { background: #f59e0b; } .pallino-stato.stato-fatto { background: #16a34a; }
.colonna-lavori .carte { display: flex; flex-direction: column; gap: .5rem; max-height: 70vh; overflow-y: auto; }
.carta-lavoro { background: var(--bs-body-bg); background: #fff; border: 1px solid var(--bordo); border-radius: 10px; padding: .55rem .7rem;
  box-shadow: var(--ombra); cursor: grab; transition: transform .1s, box-shadow .1s; }
.carta-lavoro:active { cursor: grabbing; }
.carta-lavoro.urgente { border-left: 4px solid #dc2626; }
.carta-lavoro.in-volo { opacity: .45; }
.carta-lavoro.salvata { box-shadow: 0 0 0 2px #16a34a; }
.carta-lavoro .barca-carta { font-size: .78rem; font-weight: 700; text-decoration: none; text-transform: uppercase; letter-spacing: .03em; }
.carta-lavoro .testo-carta { font-size: .92rem; margin: .15rem 0 .3rem; }
.carta-lavoro .piede-carta { display: flex; flex-wrap: wrap; gap: .25rem .7rem; font-size: .76rem; color: #667085; }
.vuota-carte { text-align: center; color: #98a2b3; font-size: .85rem; padding: 1.5rem 0; }
[data-bs-theme="dark"] .carta-lavoro { background: #1a1a1a; }
[data-bs-theme="dark"] .carta-lavoro .piede-carta { color: #a3a3a3; }

/* Più foto insieme per un lavoro (static/js/foto_raccolta.js) */
.raccolta-foto { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.foto-raccolta { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #e5e9ee; }
.foto-raccolta img { width: 100%; height: 100%; object-fit: cover; }
.foto-raccolta .togli { position: absolute; top: .25rem; right: .25rem; width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 0;
  background: rgba(15, 23, 42, .75); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
@keyframes evidenzia { from { background-color: rgba(250, 204, 21, .35); } to { background-color: transparent; } }
.lavoro-evidenziato { animation: evidenzia 2.5s ease-out; }
.lavoro-da-approvare { border-left: 4px solid #0dcaf0 !important; background: rgba(13, 202, 240, .06); }

/* Carrelli per le barche */
.griglia-carrelli { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.carrello.carico { border-top: 4px solid var(--brand); }
.numero-carrello { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--brand-chiaro); color: var(--brand-scuro); font-weight: 800; }
.carrello.carico .numero-carrello { background: var(--brand); color: var(--su-brand); }
.barra-salva-carrelli { position: sticky; bottom: 0; padding: .8rem 0; background: linear-gradient(transparent, var(--sfondo) 35%); }
@media (max-width: 991.98px) { .barra-salva-carrelli { bottom: calc(4.6rem + env(safe-area-inset-bottom)); } }

/* Scheda sicurezza della barca */
.riga-sicurezza { display: grid; grid-template-columns: 14rem 1fr; gap: .4rem 1rem; align-items: end; }
@media (max-width: 767.98px) { .riga-sicurezza { grid-template-columns: 1fr; } }
.riga-sicurezza.da-sistemare { box-shadow: inset 4px 0 0 #f59e0b; }
.riga-sicurezza.nuova { background: var(--bs-tertiary-bg, #f8fafc); }
.riga-sicurezza .nome-voce { display: flex; flex-direction: column; align-self: center; }
.riga-sicurezza .campi-voce { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: end; }
.riga-sicurezza label > span { display: block; font-size: .72rem; color: #667085; margin-bottom: .15rem; }
.campo-piccolo { width: 5.5rem; } .campo-medio { width: 9.5rem; } .campo-largo { flex: 1 1 12rem; min-width: 10rem; }
.spunta-voce { margin: 0 0 .55rem; white-space: nowrap; }
.campo-stivato { flex: 1 1 100%; margin-bottom: 0 !important; }
.campo-stivato + .row { flex: 1 1 100%; margin-bottom: 0 !important; }

/* Cerca per barca: il ripiano scritto grande */
.codice-posizione-grande { min-width: 5.5rem; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800;
  font-size: 1rem; padding: .35rem .5rem; border-radius: 8px; background: var(--brand); color: var(--su-brand); text-decoration: none; }
.codice-posizione-grande.vuoto { background: transparent; color: #98a2b3; }

/* Riquadro "✔ fatto · Annulla" in basso */
.riquadro-annulla { position: fixed; left: 50%; transform: translateX(-50%); bottom: 1.2rem; z-index: 1080; display: flex; align-items: center;
  gap: .6rem; width: min(30rem, calc(100% - 2rem)); padding: .55rem .6rem .55rem .9rem; border-radius: 12px; background: #151515; color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); font-size: .92rem; }
@media (max-width: 991.98px) { .riquadro-annulla { bottom: calc(5.4rem + env(safe-area-inset-bottom)); } }
@media print { .riquadro-annulla { display: none !important; } }

/* Linguette della scheda barca: su una riga, scorrevoli sul telefono */
.linguette-barca { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.linguette-barca .nav-link { white-space: nowrap; }
@media (max-width: 575.98px) { .linguette-barca .nav-link { padding: .5rem .6rem; font-size: .9rem; } }

/* Scheda barca sul telefono: riquadri dei numeri più compatti (tre per riga), così le linguette arrivano prima */
@media (max-width: 575.98px) {
  .griglia-riquadri { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: .45rem !important; }
  .griglia-riquadri .riquadro { padding: .55rem .6rem; min-height: 0; }
  .griglia-riquadri .riquadro .nota { display: none; }
  .griglia-riquadri .riquadro .numero { font-size: 1.25rem; }
  .griglia-riquadri .riquadro .numero-piccolo { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .griglia-riquadri .riquadro .nome { font-size: .78rem; }
  .griglia-riquadri .riquadro > .bi { font-size: 1rem; }
}

/* Assegna i lavori */
.riga-assegna.urgente { border-left: 4px solid #dc2626; }
.riga-assegna.assegnata { border-left: 4px solid #16a34a; background: #f0fdf4; }
[data-bs-theme="dark"] .riga-assegna.assegnata { background: #11281b; }
.nome-assegna.active { color: #fff !important; background: #16a34a !important; border-color: #16a34a !important; }
.altri-assegna > summary { list-style: none; }
.altri-assegna > summary::-webkit-details-marker { display: none; }

/* Visore delle foto (base.html) */
.visore-foto { position: fixed; inset: 0; z-index: 1090; background: rgba(8, 10, 12, .96); display: flex; flex-direction: column; }
.visore-foto[hidden] { display: none !important; }
.visore-barra { display: flex; align-items: center; gap: .75rem; padding: calc(.6rem + env(safe-area-inset-top)) .8rem .6rem; color: #fff; }
.visore-barra .btn { min-height: 2.8rem; padding: 0 1rem; border-radius: 999px; }
.visore-titolo { flex: 1; font-size: .9rem; color: #cfd6dc; }
.visore-conta { font-size: .85rem; color: #9aa5ae; white-space: nowrap; }
.visore-corpo { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: .5rem .5rem calc(.5rem + env(safe-area-inset-bottom)); min-height: 0; }
.visore-corpo img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.visore-freccia { position: absolute; top: 50%; transform: translateY(-50%); width: 2.8rem; height: 2.8rem; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .18); color: #fff; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; }
.visore-freccia.sinistra { left: .6rem; } .visore-freccia.destra { right: .6rem; }
.visore-freccia[hidden] { display: none; }

/* Foto degli alaggi / vari / trasporti (pagina Alaggi e vari e scheda barca) */
.foto-alaggio { display: flex; flex-wrap: wrap; gap: .3rem; }
.foto-alaggio img { width: 72px; height: 72px; object-fit: cover; border-radius: .4rem; border: 1px solid var(--bs-border-color); }

/* Pagina del lavoratore (I miei lavori): azioni in griglia e finestra delle ore di "Ho finito" */
.azioni-lavoratore { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: .5rem; }
.azioni-lavoratore .btn { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .55rem .25rem; font-size: .85rem; }
.azioni-lavoratore .btn .bi { font-size: 1.3rem; }
.griglia-ore { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.griglia-ore .btn { padding-left: 0; padding-right: 0; }
.scrivi-ufficio > summary { list-style: none; }
.scrivi-ufficio > summary::-webkit-details-marker { display: none; }


/* Dove si trova? (lavoratori) e Ordine dei lavori (2026-10-31) */
.dove-posizione { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin-top: .15rem; }
.codice-grande { font-size: 1.35rem; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; color: var(--brand); }
[data-bs-theme="dark"] .codice-grande { color: #8fb6cc; }
.riga-ordine .btn { padding: .45rem .7rem; }
.riga-ordine.appena-spostato { background: rgba(255, 196, 0, .25); transition: background .6s; }

/* =====================================================================
   Impostazioni → Luoghi: anteprime e editor del disegno
   ===================================================================== */
.luogo-anteprima { display: block; width: 11rem; height: 8rem; border: 1px solid var(--bs-border-color); border-radius: 12px;
  background: var(--bs-body-bg); padding: .3rem; }
.pianta-mini { width: 100%; height: 100%; }
.editor-luogo { display: block; width: 100%; height: min(72vh, 46rem); touch-action: none; user-select: none; cursor: grab;
  background: var(--bs-body-bg); border-radius: 8px; outline: none; }
.editor-luogo:focus-visible { box-shadow: 0 0 0 3px rgba(13, 110, 253, .35); }
.editor-luogo .griglia line { stroke: #94a3b8; stroke-opacity: .35; }
.editor-luogo .bordo rect { fill: none; stroke: #1f2937; }
.editor-luogo .elemento { cursor: move; }
.editor-luogo .elemento.scelto { stroke: #2563eb !important; }
.editor-luogo .maniglia { fill: #fff; stroke: #2563eb; cursor: nwse-resize; }
.editor-luogo .maniglia[data-angolo="ne"], .editor-luogo .maniglia[data-angolo="sw"] { cursor: nesw-resize; }
.editor-luogo .etichetta { fill: #111827; font-weight: 600; }
.editor-luogo .quota { fill: #475569; font-weight: 600; }
.editor-luogo .quota.scelta { fill: #2563eb; }
[data-bs-theme="dark"] .editor-luogo .bordo rect { stroke: #e5e7eb; }
[data-bs-theme="dark"] .editor-luogo .etichetta { fill: #f1f5f9; }
[data-bs-theme="dark"] .editor-luogo .quota { fill: #cbd5e1; }
.editor-zoom { position: absolute; top: .6rem; right: .6rem; }
.campione { display: inline-block; width: 1rem; height: .75rem; border-radius: 3px; vertical-align: -.05rem; margin-right: .25rem;
  border: 2px solid; }
.campione-spazio { background: rgba(14, 116, 144, .18); border-color: #0e7490; }
.campione-esterno { background: rgba(100, 116, 139, .18); border-color: #64748b; border-style: dashed; }
.campione-ostacolo, .campione-muro { background: rgba(107, 114, 128, .55); border-color: #6b7280; }
.campione-pilastro { background: #6b7280; border-color: #6b7280; width: .6rem; }
.campione-portone { background: #f59e0b; border-color: #b45309; }
.campione-info { background: rgba(148, 163, 184, .12); border-color: #94a3b8; border-style: dashed; }
.editor-luogo .sfondo { pointer-events: none; }
.editor-luogo.modo-sfondo { cursor: crosshair; }
.editor-luogo .punto-scala { fill: #dc2626; stroke: #fff; stroke-width: .05; }
.editor-luogo .linea-scala { stroke: #dc2626; stroke-dasharray: .3 .2; }
.campione-zona { background: rgba(194, 65, 12, .2); border-color: #c2410c; }
.campione-sagoma { background: rgba(37, 99, 235, .15); border-color: #2563eb; }
