/* ==========================================================================
   Design tokens condivisi. body.role-admin / body.role-operator sovrascrivono
   le variabili qui sotto per dare due linguaggi visivi coerenti ma distinti:
   - admin/ufficio: sidebar scura, densità maggiore, tabelle -> aspetto "gestionale"
   - operatore: card grandi, alto contrasto, touch-friendly -> aspetto "operativo"
   ========================================================================== */
:root {
  --brand: #1f6532;
  --brand-dark: #144222;
  --brand-soft: #e6f0e8;
  --bg: #f4f6f4;
  --card-bg: #ffffff;
  --text: #1c231d;
  --muted: #5b6a5d;
  --border: #dfe6e0;
  --radius: 10px;
  --density: 14px;
  --font-size-base: 15px;
  --sidebar-bg: #ffffff;
  --sidebar-text: var(--text);
  --sidebar-muted: var(--muted);
  --sidebar-active-bg: var(--brand-soft);
  --sidebar-active-text: var(--brand-dark);
}

body.role-admin {
  --bg: #eef1f0;
  --sidebar-bg: #16281c;
  --sidebar-text: #d9e6dc;
  --sidebar-muted: #8fa896;
  --sidebar-active-bg: #234a2f;
  --sidebar-active-text: #ffffff;
  --density: 9px;
  --font-size-base: 14px;
  --radius: 8px;
}

body.role-operator {
  --bg: #f4f7f4;
  --density: 16px;
  --font-size-base: 16px;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--font-size-base);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--brand);
  font-weight: 600;
  margin: 0 0 4px;
}

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

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.form-grid.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9em;
  font-weight: 600;
}

.form-grid label.span-2 { grid-column: span 2; }

input, select, textarea {
  padding: calc(var(--density) * 0.7) 12px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.7);
  font-size: 1em;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

button, .btn {
  cursor: pointer;
  border-radius: calc(var(--radius) * 0.7);
  border: 1px solid var(--border);
  background: #fff;
  padding: calc(var(--density) * 0.7) 14px;
  font-size: 0.93em;
  font-family: inherit;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

button.primary, .btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

button.primary:hover, .btn.primary:hover { background: var(--brand-dark); }

button.danger, .btn.danger { color: #b3261e; border-color: #e6b6b0; }
button.wide { width: 100%; justify-content: center; }
button.ghost, .btn.ghost { background: transparent; }
button.small, .btn.small { padding: 6px 10px; font-size: 13px; }

.status-text { text-align: center; font-size: 14px; }
.status-text.error { color: #b3261e; }
.status-text.success { color: var(--brand-dark); }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--brand);
  color: #fff;
  flex-wrap: nowrap;
}

body.role-admin .topbar { background: #10200f; }

.topbar .brand {
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  display: flex;
  align-items: center;
}

.brand-logo { height: 30px; display: block; }

.login-logo { display: block; max-width: 240px; width: 70%; margin: 0 auto 14px; }

.nav-back {
  display: inline-flex;
  flex-shrink: 0;
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.5);
  padding: 6px 10px;
  font-size: 16px;
  line-height: 1;
}

body.nav-back-hidden .nav-back { display: none; }
.topbar .page-title { opacity: 0.85; font-size: 0.95em; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.topbar .current-user { font-size: 13px; opacity: 0.9; white-space: nowrap; }
.topbar button.ghost { color: #fff; border-color: rgba(255,255,255,0.5); flex-shrink: 0; }

.nav-toggle {
  display: none;
  flex-shrink: 0;
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.5);
  padding: 6px 10px;
  font-size: 16px;
  line-height: 1;
}

.app-body { display: flex; flex: 1; min-height: 0; }

/* --- Sidebar: densa e scura per admin/ufficio ("gestionale"), assente per operatore --- */
.sidebar {
  width: 226px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-muted);
  padding: 6px 10px 10px;
}

.sidebar a {
  padding: 9px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar a .ic { width: 1.1em; text-align: center; opacity: 0.9; }
.sidebar a:hover { background: var(--sidebar-active-bg); }
.sidebar a.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600; }
.sidebar hr { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 8px 4px; }

body:not(.role-admin) .sidebar hr,
body.role-operator .sidebar { display: none; }

.sidebar-backdrop { display: none; }

.content { flex: 1; padding: 24px; max-width: 1180px; }

.hero-card { display: flex; align-items: center; gap: 16px; }

/* --- Stat tiles: righe di indicatori tipiche di un cruscotto "gestionale" --- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stat-tile {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-tile .stat-value { font-size: 26px; font-weight: 700; color: var(--brand-dark); }
.stat-tile .stat-label { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

/* --- Data table: componente denso per le liste anagrafiche (admin/ufficio) --- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); }

table.data-table { width: 100%; border-collapse: collapse; font-size: 0.93em; }
table.data-table th, table.data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
table.data-table th { background: #f8faf8; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 700; }
table.data-table tbody tr:hover { background: var(--brand-soft); }
table.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table td.actions { white-space: nowrap; text-align: right; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--brand-soft); color: var(--brand-dark); }
.badge.badge-muted { background: #eee; color: var(--muted); }
.badge.badge-warn { background: #fdecc8; color: #8a5a00; }
.badge.badge-danger { background: #fbe1de; color: #9c2c22; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.page-header h1 { margin: 0 0 4px; font-size: 22px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- Vista operativa: card grandi e ad alto contatto, niente tabelle dense --- */
body.role-operator .content { padding: 18px; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.action-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center !important;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

main{
  width: 100%;
  padding: 2%;
}

.action-card .ic { font-size: 26px; }
.action-card:hover { border-color: var(--brand); background: var(--brand-soft); }

.hidden { display: none !important; }

/* Pallino notifica rosso con contatore (es. permessi in attesa) */
.badge-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: auto;
  border-radius: 999px;
  background: #d23b3b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* --- Select con ricerca (js/searchable-select.js): il select nativo resta
       nel DOM nascosto, l'input filtra le opzioni in un dropdown --- */
.ss-wrap { position: relative; }
.ss-wrap select.ss-native { display: none; }
.ss-input { width: 100%; }
.ss-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 40;
  margin: 2px 0 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.7);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  max-height: 240px;
  overflow-y: auto;
}
.ss-list.open { display: block; }
.ss-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.ss-list li:hover { background: var(--brand-soft); }
.ss-list li.selected { background: var(--brand-soft); font-weight: 600; }
.ss-list li.empty { color: var(--muted); cursor: default; }

/* --- Menu a tendina a selezione multipla (checkbox in dropdown) --- */
.ms-dropdown { position: relative; }
.ms-field {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 40px;
  padding: 6px 30px 6px 10px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.7);
  background: #fff;
  cursor: pointer;
  position: relative;
}
.ms-field::after {
  content: "▾";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}
.ms-field .ms-placeholder { color: var(--muted); }
.ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  font-size: 0.85em;
  font-weight: 600;
}
.ms-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 40;
  margin: 2px 0 0;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.7);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
.ms-panel.open { display: block; }
.ms-search { width: 100%; margin-bottom: 6px; }
.ms-options { max-height: 220px; overflow-y: auto; }
.ms-options label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  margin: 0;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.ms-options label:hover { background: var(--brand-soft); }
.ms-options label.hidden { display: none; }
.ms-options input { width: auto; }
.ms-empty { color: var(--muted); padding: 6px 8px; }

/* --- Barra stato offline / documenti in attesa --- */
.offline-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  font-size: 0.88em;
  background: #fdecc8;
  color: #8a5a00;
  border-bottom: 1px solid #f0d79a;
}
.offline-bar.pending-only { background: var(--brand-soft); color: var(--brand); border-bottom-color: var(--border); }
.offline-bar.hidden { display: none; }
.offline-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #1f2d24;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 2000;
  max-width: 90%;
  text-align: center;
  font-size: 0.9em;
}
.offline-toast.hidden { display: none; }

/* --- Calendario programma trattamenti --- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head {
  text-align: center;
  font-weight: 700;
  font-size: 0.8em;
  color: var(--muted);
  text-transform: uppercase;
  padding: 4px 0;
}
.cal-cell {
  min-height: 66px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 5px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
}
.cal-cell.has-plans { border-color: var(--brand); }
.cal-cell.out { background: #f6f6f4; opacity: 0.6; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-daynum { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 0.85em; color: var(--muted); }
.cal-add { text-decoration: none; color: var(--brand); font-weight: 700; padding: 0 5px; border-radius: 5px; }
.cal-add:hover { background: var(--brand-soft); }
.cal-count {
  min-width: 26px; height: 26px; padding: 0 7px; margin-top: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; border-radius: 999px;
  font-size: 0.85em; font-weight: 700;
}
/* Scheda del giorno (modale) */
.cal-modal { position: fixed; inset: 0; z-index: 1500; background: rgba(0,0,0,0.45); display: flex; align-items: flex-end; justify-content: center; }
.cal-modal.hidden { display: none; }
.cal-modal-card { background: #fff; width: 100%; max-width: 540px; border-radius: 16px 16px 0 0; padding: 16px; max-height: 82vh; overflow-y: auto; }
.cal-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-modal-head strong { font-size: 1.05em; text-transform: capitalize; }
.cal-modal-close { background: none; border: none; font-size: 1.3em; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.cal-panel-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--border); }
.cal-panel-item .title { text-decoration: none; color: inherit; font-weight: 600; flex: 1; min-width: 140px; }
.cal-panel-empty { color: var(--muted); padding: 8px 0 12px; }
@media (min-width: 641px) {
  .cal-modal { align-items: center; }
  .cal-modal-card { border-radius: 16px; }
}

/* --- Righe dinamiche: separazione visiva a card --- */
.row-card {
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
  background: var(--card-bg);
}

.qr-reader { flex-basis: 100%; width: 100%; max-width: 320px; margin: 6px 0; border: 1px dashed var(--brand); border-radius: calc(var(--radius) * 0.7); overflow: hidden; }
.qr-status { font-size: 12px; color: var(--muted); }
.qr-status.success { color: var(--brand-dark); font-weight: 600; }
.qr-status.error { color: #b3261e; font-weight: 600; }

/* --- Righe dinamiche (template JS clonati): larghezze flessibili invece di px fissi --- */
.or-row, .tr-product-row, .fw-row, .wr-vehicle {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.or-row label, .tr-product-row label, .fw-row label, .wr-vehicle label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9em;
  font-weight: 600;
  flex: 1 1 160px;
  min-width: 140px;
}

.or-row input, .tr-product-row input, .fw-row input, .wr-vehicle input,
.or-row select, .tr-product-row select, .fw-row select, .wr-vehicle select {
  width: 100%;
}

@media (max-width: 720px) {
  .app-body { flex-direction: column; }
  .form-grid.form-grid-2col { grid-template-columns: 1fr; }
  .form-grid label.span-2 { grid-column: span 1; }

  .or-row, .tr-product-row, .fw-row, .wr-vehicle { flex-direction: column; align-items: stretch; }
  .or-row label, .tr-product-row label, .fw-row label, .wr-vehicle label { flex-basis: auto; min-width: 0; }

  /* --- Topbar: solo brand + hamburger + logout, il resto si nasconde --- */
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar .page-title,
  .topbar .current-user { display: none; }
  .nav-toggle { display: inline-flex; }

  /* --- Sidebar: drawer laterale sopra un backdrop, invece della barra orizzontale --- */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(280px, 82vw);
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 60;
    box-shadow: 2px 0 12px rgba(0,0,0,0.25);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar a { padding: 12px 10px; font-size: 15px; }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 55;
  }
  .sidebar-backdrop.open { display: block; }

  /* --- Tabelle dati: da tabella orizzontale a card impilate --- */
  .table-wrap { border: none; background: transparent; overflow-x: visible; }

  table.data-table thead { display: none; }
  table.data-table, table.data-table tbody, table.data-table tr, table.data-table td {
    display: block;
    width: 100%;
  }
  table.data-table tr {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 4px 0;
  }
  table.data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }
  table.data-table tr td:last-child { border-bottom: none; }
  table.data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
  table.data-table td.actions { justify-content: flex-end; }
  table.data-table td.actions::before { content: none; }

  /* --- Touch target minimo per pulsanti compatti --- */
  button.small, .btn.small { min-height: 40px; padding: 8px 12px; }
}

/* --- Animazione "impacchetta e sposta nella commessa" (storico/materiali cantiere) --- */
@keyframes commessa-pack {
  0%   { transform: none;                                opacity: 1; }
  25%  { transform: scale(0.94) rotate(-1deg);           opacity: 1; }
  45%  { transform: scale(0.86);                          opacity: 1; background: color-mix(in srgb, var(--accent) 16%, transparent); }
  100% { transform: scale(0.28) translate(-40px, -120px) rotate(-8deg); opacity: 0; }
}
tr.commessa-packing > td {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
tr.commessa-packing {
  animation: commessa-pack 0.6s cubic-bezier(0.5, 0, 0.75, 0.2) forwards;
  transform-origin: left center;
  will-change: transform, opacity;
}
/* Il numero della commessa "riceve" il pacchetto con un piccolo pulse. */
@keyframes commessa-receive {
  0%   { transform: none; }
  40%  { transform: scale(1.18); }
  100% { transform: none; }
}
.commessa-receiving { animation: commessa-receive 0.5s ease-out; display: inline-block; }
@media (prefers-reduced-motion: reduce) {
  tr.commessa-packing { animation: none; opacity: 0; }
  .commessa-receiving { animation: none; }
}

/* Riga materiale già scalato dal magazzino (Esolver): sfondo verde tenue. */
tr.row-scaled > td { background: color-mix(in srgb, var(--brand) 8%, transparent); }

/* ============================================================
   Animazioni UI (veloci, discrete) — rispettano prefers-reduced-motion
   ============================================================ */

/* --- Splash all'apertura (schermata login) --- */
.vc-splash {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand, #1f6532);
  animation: vc-splash-out 0.55s ease 1.15s forwards;
}
.vc-splash img { width: 190px; max-width: 55vw; animation: vc-splash-logo 1s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
@keyframes vc-splash-logo {
  0%   { opacity: 0; transform: scale(0.82) translateY(8px); }
  60%  { opacity: 1; transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes vc-splash-out { to { opacity: 0; visibility: hidden; } }

/* --- Benvenuto dopo l'accesso --- */
.vc-welcome {
  position: fixed; inset: 0; z-index: 55;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--brand, #1f6532); color: #fff; padding: 24px;
}
.vc-welcome.vc-welcome-run { animation: vc-welcome-out 0.5s ease 1.5s forwards; }
.vc-welcome .vc-w-inner { animation: vc-welcome-in 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.vc-welcome .vc-w-hi { font-size: 15px; opacity: 0.85; margin: 0 0 6px; }
.vc-welcome .vc-w-name { font-size: 30px; font-weight: 800; margin: 0; }
@keyframes vc-welcome-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes vc-welcome-out { to { opacity: 0; visibility: hidden; } }

/* --- Toast conferma "✓ Inviato" --- */
.vc-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--brand-dark, #164a25); color: #fff; z-index: 70;
  padding: 12px 18px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  display: flex; align-items: center; gap: 10px; font-weight: 600;
  animation: vc-toast-in 0.28s ease both, vc-toast-out 0.4s ease 2s forwards;
}
.vc-toast svg { width: 22px; height: 22px; display: block; }
.vc-toast svg path { stroke: #fff; stroke-width: 3.5; fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 26; stroke-dashoffset: 26; animation: vc-check-draw 0.45s ease 0.15s forwards; }
.vc-toast circle { fill: none; stroke: rgba(255,255,255,.5); stroke-width: 2.5; }
@keyframes vc-check-draw { to { stroke-dashoffset: 0; } }
@keyframes vc-toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes vc-toast-out { to { opacity: 0; transform: translate(-50%, 12px); visibility: hidden; } }

/* --- Feedback lettura QR: lampo verde sul campo --- */
@keyframes vc-qr-hit {
  0%   { background: color-mix(in srgb, var(--brand) 45%, transparent); }
  100% { background: transparent; }
}
.qr-hit { animation: vc-qr-hit 0.9s ease; }

/* --- Righe che compaiono in dissolvenza --- */
@keyframes vc-row-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.row-in { animation: vc-row-in 0.28s ease both; }
@keyframes vc-row-out { to { opacity: 0; transform: translateY(-6px); height: 0; } }
.row-out { animation: vc-row-out 0.25s ease forwards; overflow: hidden; }

/* --- Ingresso morbido dei popup --- */
@keyframes vc-pop-in { from { opacity: 0; transform: scale(0.94) translateY(8px); } to { opacity: 1; transform: none; } }
.vc-pop-in { animation: vc-pop-in 0.3s cubic-bezier(0.2, 0.7, 0.3, 1) both; }

/* --- Badge di notifica con piccolo pulse --- */
@keyframes vc-badge-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.badge-dot { animation: vc-badge-pulse 1.8s ease-in-out 2; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  .vc-splash, .vc-splash img, .vc-welcome.vc-welcome-run, .vc-welcome .vc-w-inner,
  .vc-toast, .vc-toast svg path, .qr-hit, .row-in, .row-out, .vc-pop-in, .badge-dot {
    animation: none !important;
  }
  .vc-splash { animation: vc-splash-out 0.01s linear 0.8s forwards !important; }
  .vc-welcome.vc-welcome-run { animation: vc-welcome-out 0.01s linear 1.2s forwards !important; }
  .row-out { display: none; }
}

/* ===== Selettore lingua (login) ===== */
.lang-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 0 0 14px;
}
.lang-switch .lang-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  line-height: 1;
  text-decoration: none;
  color: var(--text, #222);
  background: var(--card-bg, #fff);
  white-space: nowrap;
}
.lang-switch .lang-flag span { font-size: 0.85rem; }
.lang-switch .lang-flag.active {
  border-color: var(--brand, #1f6532);
  background: var(--brand, #1f6532);
  color: #fff;
  font-weight: 600;
}
