/* ==========================================================================
   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);
  /* Colori delle categorie di moduli (dashboard + menù): stesso colore = stessa famiglia. */
  --cat-direzionale: #1f6532;
  --cat-vivaio: #6b8423;
  --cat-areaverde: #0d7466;
  --cat-operativa: #2b6795;
  --cat-reportistica: #a2650f;
  --cat-anagrafiche: #6a5893;
  --cat-gestione: #5a6660;
  --cat-preferiti: #b88a00;
  --cat-commerciale: #a8324a;
}

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;
}

/* Barra visibile solo sull'istanza di test (APP_ENVIRONMENT=test). */
.env-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 6px 12px;
  background: repeating-linear-gradient(45deg, #b3261e, #b3261e 14px, #8c1d18 14px, #8c1d18 28px);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  letter-spacing: 0.02em;
}
.login-body .env-banner { position: fixed; left: 0; right: 0; }

.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, .topbar .btn.ghost { color: #fff; border-color: rgba(255,255,255,0.5); flex-shrink: 0; }
.topbar .btn.ghost:hover { background: rgba(255,255,255,0.1); }

.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-search {
  width: calc(100% - 12px);
  margin: 0 6px 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text);
  font-size: 13px;
}
.sidebar-search::placeholder { color: var(--sidebar-muted); }
.sidebar-noresult {
  font-size: 12px;
  color: var(--sidebar-muted);
  padding: 4px 10px 8px;
}
/* Nascondi voci/lettere filtrate dalla ricerca (batte il display:flex di .sidebar a) */
.sidebar a.sb-hide,
.sidebar-letter.sb-hide { display: none !important; }

.sidebar-letter {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  padding: 10px 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 6px;
}
.sidebar-letter:first-of-type { border-top: none; margin-top: 2px; }

.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); }

/* Preferiti: stella su ogni card (vista operatore e vecchie card) */
.fav-star {
  position: absolute; top: 8px; left: 8px; margin: 0;
  font-size: 16px; line-height: 1; color: #c9a400; cursor: pointer;
  opacity: 0.5; user-select: none;
}
.fav-star:hover { opacity: 1; }
.fav-star.on { opacity: 1; color: #e0a800; }

.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;
}

/* ---------- Quadro giornaliero vivaio (griglia stile Excel ore) ---------- */
.qv-alert { margin-bottom: 12px; padding: 14px 16px; border-left: 4px solid #d9822b; }
.qv-alert-info { border-left-color: #2b6cb0; }
.qv-list { margin: 8px 0 0; padding-left: 18px; }
.qv-list li { margin: 4px 0; }
.qv-wrap { overflow: auto; max-height: calc(100vh - 140px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); }
.qv-table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.qv-table th, .qv-table td { padding: 3px 4px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.qv-table thead th { position: sticky; top: 0; background: #f7f8f7; font-size: 11.5px; font-weight: 600; text-align: left; z-index: 2; }
.qv-table thead tr.qv-groups th { top: 0; text-align: center; font-size: 12px; }
.qv-table thead tr:nth-child(2) th { top: 24px; }
.qv-g-chi { background: #eef2f6 !important; }
.qv-g-dir, .qv-table thead .qv-c-dir { background: #e2efda !important; }
.qv-g-ind, .qv-table thead .qv-c-ind { background: #fbe2d5 !important; }
.qv-g-mezzi, .qv-table thead .qv-c-mezzi { background: #e4dfec !important; }
.qv-g-tot, .qv-table thead .qv-c-tot { background: #fff2cc !important; }
.qv-table tbody .qv-c-dir { background: #f4faf1; }
.qv-table tbody .qv-c-ind { background: #fdf3ee; }
.qv-table tbody .qv-c-mezzi { background: #f5f3f8; }
.qv-table tbody .qv-c-tot { background: #fffbea; font-weight: 700; text-align: right; min-width: 38px; }
.qv-gap { width: 4px; padding: 0 !important; }
.qv-sticky { position: sticky; left: 0; z-index: 1; background: var(--card-bg); box-shadow: 1px 0 0 var(--border); }
.qv-table thead .qv-sticky { z-index: 3; }
.qv-name { min-width: 190px; max-width: 240px; white-space: normal !important; line-height: 1.25; }
.qv-nome { font-weight: 600; display: block; }
.qv-sub { display: block; font-size: 11px; }
.qv-nota { display: block; color: #b45309; font-size: 11px; white-space: normal; }
.qv-check { display: block; font-size: 11px; font-weight: 700; }
.qv-ok { color: #1f6532; }
.qv-err { color: #b3261e; }
.qv-row:not(.qv-person-start) .qv-name .qv-nome { color: var(--muted); font-weight: 400; }
.qv-row.qv-person-start td { border-top: 2px solid #c9d3cb; }
/* Utilizzo mezzi: righe raggruppate per persona (nome in grassetto solo sulla prima) */
table.data-table tr.mz-persona:not(:first-child) td { border-top: 2px solid #c9d3cb; }
table.data-table td.mz-chi { font-weight: 600; white-space: nowrap; }
table.data-table tr.mz-stessa td.mz-chi { color: var(--muted); font-weight: 400; }
.qv-num { width: 54px; padding: 3px 4px; font-size: 12.5px; text-align: right; }
.qv-info { background: #f3f4f3; }
.qv-txt { width: 130px; padding: 3px 5px; font-size: 12.5px; }
.qv-short { width: 78px; }
.qv-sel { max-width: 170px; padding: 3px 4px; font-size: 12px; }
.qv-actions { text-align: right; }
.qv-actions .btn.small { padding: 2px 7px; min-height: 0; }
.qv-footer {
  position: sticky; bottom: 0; z-index: 4; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 12px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 -4px 14px rgba(0,0,0,0.06);
}

/* ==========================================================================
   Dashboard ufficio per categorie
   Ogni categoria ha il suo colore (--cat): striscia in alto, icona e bordo al
   passaggio. Lo stesso colore segna il gruppo nel menù a sinistra.
   ========================================================================== */
[data-cat="direzionale"]  { --cat: var(--cat-direzionale); }
[data-cat="vivaio"]      { --cat: var(--cat-vivaio); }
[data-cat="areaverde"]   { --cat: var(--cat-areaverde); }
[data-cat="operativa"]    { --cat: var(--cat-operativa); }
[data-cat="reportistica"] { --cat: var(--cat-reportistica); }
[data-cat="anagrafiche"] { --cat: var(--cat-anagrafiche); }
[data-cat="gestione"]    { --cat: var(--cat-gestione); }
[data-cat="preferiti"]   { --cat: var(--cat-preferiti); }
[data-cat="commerciale"] { --cat: var(--cat-commerciale); }

.dash { --cat: var(--brand); }

.dash-hello {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px 24px; flex-wrap: wrap; margin: 2px 2px 16px;
}
.dash-hello h1 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; }
.dash-hello p { margin: 4px 0 0; }
.dash-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-stat {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--card-bg); border: 1px solid var(--border);
  color: var(--muted); font-size: 13px; text-decoration: none;
}
.dash-stat strong { color: var(--brand-dark); font-size: 16px; font-variant-numeric: tabular-nums; }
.dash-stat:hover { border-color: var(--brand); }

.dash-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 14px;
  align-items: start;
}

.dash-group {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--cat);
  border-radius: var(--radius);
  padding: 10px 10px 12px;
}
.dash-group-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 2px 4px 10px; font-size: 15px; font-weight: 700; color: var(--text);
}
.dash-dot {
  width: 10px; height: 10px; border-radius: 3px; background: var(--cat); flex-shrink: 0;
}
.dash-hint { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted); }

.dash-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 8px;
}

/* Card modulo: compatta, icona a sinistra nel colore della categoria. */
.action-card.dash-tile {
  position: relative;
  flex-direction: row; align-items: center; justify-content: flex-start;
  text-align: left !important;
  gap: 10px; min-height: 52px; padding: 8px 10px;
  font-size: 14px; font-weight: 600; line-height: 1.25;
  border-radius: 8px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-user-drag: none;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.dash-tile .ic {
  display: grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 8px; font-size: 18px;
  background: color-mix(in srgb, var(--cat) 12%, #fff);
}
.dash-tile .lbl { flex: 1; min-width: 0; hyphens: manual; overflow-wrap: normal; padding-right: 10px; }
.action-card.dash-tile:hover { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 6%, #fff); }
.action-card.dash-tile:focus-visible { outline: 2px solid var(--cat); outline-offset: 2px; }

/* Stella: discreta nell'angolo, compare al passaggio; sempre visibile se attiva o sul telefono. */
.dash-tile .fav-star {
  position: absolute; top: 3px; right: 3px; left: auto; margin: 0;
  width: 20px; height: 20px; display: grid; place-items: center;
  font-size: 13px; opacity: 0; color: var(--cat-preferiti); border-radius: 5px;
}
.dash-tile .badge-dot { position: absolute; bottom: 5px; right: 6px; min-width: 17px; height: 17px; font-size: 10.5px; }
.dash-tile:hover .fav-star, .dash-tile .fav-star:focus-visible, .dash-tile .fav-star.on { opacity: 0.9; }
.dash-tile .fav-star:hover { opacity: 1; background: color-mix(in srgb, var(--cat-preferiti) 14%, #fff); }
@media (hover: none) { .dash-tile .fav-star { opacity: 0.45; } .dash-tile .fav-star.on { opacity: 1; } }

/* Area Preferiti in cima. */
.dash-fav {
  margin-bottom: 14px;
  background: color-mix(in srgb, var(--cat-preferiti) 5%, var(--card-bg));
}
.dash-fav .dash-dot { background: none; width: auto; height: auto; color: var(--cat-preferiti); font-size: 15px; line-height: 1; }
.dash-fav .dash-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); min-height: 52px; }
.dash-fav .dash-tile { cursor: grab; }
.dash-fav-empty { margin: -4px 4px 14px; font-size: 13px; color: var(--muted); }

/* Sezione intera nei preferiti: stella accanto al titolo; in cima, con il bordo dorato. */
.sec-star {
  margin-left: auto; padding: 2px 7px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--cat-preferiti); font-size: 16px; line-height: 1; opacity: 0.55;
}
.sec-star:hover, .sec-star:focus-visible { opacity: 1; border-color: var(--border); background: #fff; }
.sec-star.on { opacity: 1; }
.sec-pin-label { display: none; font-size: 12px; font-weight: 600; color: var(--cat-preferiti); }
.sec-pinned .sec-pin-label { display: inline; }
.sec-pinned { box-shadow: 0 0 0 1px color-mix(in srgb, var(--cat-preferiti) 45%, transparent); }
.sec-pinned .dash-group-head { cursor: grab; }
.sec-dragging { opacity: 0.6; outline: 2px dashed color-mix(in srgb, var(--cat-preferiti) 60%, transparent); outline-offset: 2px; }

/* Trascinamento */
body.fav-dragging, body.fav-dragging * { cursor: grabbing !important; user-select: none; }
.dash-fav.fav-drop { outline: 2px dashed color-mix(in srgb, var(--cat-preferiti) 60%, transparent); outline-offset: 3px; }
.fav-placeholder { opacity: 0.35; border-style: dashed !important; }
.fav-ghost {
  position: fixed !important; top: 0; left: 0; z-index: 3000; margin: 0; pointer-events: none;
  box-shadow: 0 12px 28px rgba(20, 40, 25, 0.22); transform-origin: center;
  background: var(--card-bg) !important; border-color: var(--cat) !important;
}
@keyframes fav-land { 0% { transform: scale(1.06); } 100% { transform: none; } }
.fav-landed { animation: fav-land 0.35s ease-out; }

/* Menù a sinistra: voce del modulo aperto. */
.sidebar a.active { box-shadow: inset 3px 0 0 #8fd19e; }

/* ---- Rapporti: navigazione tra i giorni ---- */
.day-nav { margin-bottom: 16px; }
.day-nav-date { display: inline-flex; align-items: center; gap: 8px; padding: 0 6px; }
.day-nav-date strong { font-size: 17px; }
.day-nav-pick input { padding: 6px 8px; }

/* ==========================================================================
   Schede affiancate (/schede)
   ========================================================================== */
html.in-frame .topbar,
html.in-frame .sidebar,
html.in-frame .sidebar-backdrop,
html.in-frame .env-banner,
html.in-frame .shell-popup,
html.in-frame .offline-bar { display: none !important; }
html.in-frame .content, html.in-frame main { max-width: none; }

main.ws-main { padding: 0; max-width: none; display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
/* La pagina Schede occupa esattamente la finestra: scorrono solo il menù e le schede. */
body:has(main.ws-main) { height: 100vh; overflow: hidden; }
body:has(main.ws-main) .app-body { min-height: 0; }
body:has(main.ws-main) .sidebar { overflow-y: auto; }
.ws { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.topbar .topbar-tabs[hidden] { display: none; }

.ws-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; background: #e3e9e5; border-bottom: 1px solid var(--border);
}
.ws-nav, .ws-tools { display: flex; gap: 4px; flex-shrink: 0; }
.ws-tools { margin-left: auto; }
.ws-btn {
  padding: 5px 9px; font-size: 13px; line-height: 1.2; border-radius: 6px;
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text); text-decoration: none;
}
.ws-btn:hover { border-color: var(--brand); }
.ws-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ws-btn.disabled { pointer-events: none; opacity: 0.4; }
.ws-new { font-weight: 700; font-size: 15px; padding: 3px 10px; flex-shrink: 0; }

.ws-tabs {
  display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: thin;
  padding: 2px 0;
}
.ws-tab {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  max-width: 220px; padding: 5px 4px 5px 10px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.55); border: 1px solid transparent;
  font-size: 13px; color: var(--muted); cursor: pointer; user-select: none;
}
.ws-tab:hover { background: #fff; color: var(--text); }
.ws-tab.is-visible { background: #fff; color: var(--text); border-color: var(--border); }
.ws-tab.is-active { border-color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); font-weight: 600; }
.ws-tab[data-side]::before {
  content: attr(data-side); display: inline-grid; place-items: center;
  width: 16px; height: 16px; border-radius: 4px; font-size: 10.5px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand-dark);
}
.ws-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ws-tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-tab-close {
  border: none; background: transparent; padding: 0 5px; font-size: 15px; line-height: 1;
  color: var(--muted); border-radius: 4px;
}
.ws-tab-close:hover { background: #fbe1de; color: #9c2c22; }

.ws-panes { position: relative; display: flex; flex: 1; min-height: 0; background: var(--bg); }
.ws-frame { display: none; flex: 1 1 0; min-width: 0; height: 100%; border: 0; background: var(--bg); }
.ws-frame.is-left { display: block; order: 1; }
.ws-panes.is-split .ws-frame.is-right { display: block; order: 3; }
.ws-panes.is-split .ws-frame.is-focus, .ws-pick.is-focus { box-shadow: inset 0 0 0 2px var(--brand); }
.ws-panes.is-resizing .ws-frame { pointer-events: none; }
.ws-divider {
  order: 2; flex: 0 0 8px; cursor: col-resize; background: #dfe6e0; position: relative;
}
.ws-divider::after {
  content: ""; position: absolute; top: 50%; left: 2px; width: 4px; height: 36px; margin-top: -18px;
  border-radius: 2px; background: #a9b8ad;
}
.ws-divider:hover, .ws-divider:focus-visible { background: #c9d6cc; outline: none; }
.ws-divider[hidden], .ws-pick[hidden] { display: none; }
.ws-pick {
  order: 3; flex: 1 1 0; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; padding: 24px; color: var(--text);
}
.ws-pick p { margin: 4px 0; max-width: 340px; }
.ws-empty { margin: 48px auto; max-width: 460px; text-align: center; padding: 0 16px; }

@media (max-width: 899px) {
  .ws-split { display: none; }
  .ws-divider { display: none !important; }
}
@media (min-width: 721px) {
  /* Menù a sinistra sempre a portata: resta fermo e scorre per conto suo. */
  .sidebar { position: sticky; top: 0; align-self: flex-start; max-height: 100vh; overflow-y: auto; }
  body:has(main.ws-main) .sidebar { position: static; align-self: stretch; max-height: none; }
}
@media (max-width: 720px) {
  .topbar .topbar-tabs { display: none; }
  .dash-groups { grid-template-columns: 1fr; }
  .dash-hello h1 { font-size: 20px; }
  .dash-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fav-landed { animation: none; }
  .action-card.dash-tile { transition: none; }
}

/* ---- Nuova commessa: scelta di dove va (nuovo cantiere / cantiere esistente / da sola) ---- */
.nc-form { max-width: 860px; }
.nc-title { font-size: 16px; margin: 0; }
.nc-help { font-size: 12px; font-weight: 400; }
.nc-extra { align-self: flex-start; font-size: 12px; font-weight: 700; color: #8a5a00; background: #fdecc8;
  padding: 2px 8px; border-radius: 999px; }
.nc-modi { border: 0; padding: 0; margin: 16px 0; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.nc-modi legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.nc-modo { display: flex; gap: 10px; align-items: flex-start; padding: 12px; cursor: pointer;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); }
.nc-modo input { width: auto; margin-top: 3px; accent-color: var(--brand); }
.nc-modo span { display: flex; flex-direction: column; gap: 3px; }
.nc-modo .muted { font-size: 12.5px; }
.nc-modo.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.nc-modo:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.nc-panel[hidden] { display: none; }

/* ==========================================================================
   Protezioni contro gli errori (form-guard.js) e elenchi (list-filter.js)
   ========================================================================== */
/* Asterisco dei campi obbligatori */
.req-mark { color: #b3261e; font-weight: 700; margin-left: 3px; }
/* Campo da correggere */
input.field-error, select.field-error, textarea.field-error, .ss-wrap.field-error .ss-input,
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: #b3261e !important;
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.12);
}
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: #b3261e; }
/* Avviso leggero sotto un campo (data nel futuro, ecc.) */
.field-hint { font-size: 12.5px; font-weight: 600; }
.field-hint.warn { color: #8a5a00; }
/* Messaggio d'errore in cima alla pagina: un riquadro ben visibile */
main > .status-text.error, main > form > .status-text.error, .card > .status-text.error:first-child {
  text-align: left; background: #fbe1de; border: 1px solid #efb7b0; border-radius: var(--radius);
  padding: 10px 14px; color: #8c1d18; font-weight: 600;
}
/* Pulsante durante il salvataggio */
button.is-saving { opacity: 0.75; cursor: progress; }
button.is-saving::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: vc-spin 0.7s linear infinite;
}
@keyframes vc-spin { to { transform: rotate(360deg); } }
button:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; }
/* Fuoco tastiera sempre visibile */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Filtro rapido sopra gli elenchi */
.list-filter { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; flex-wrap: wrap; }
.list-filter-input { flex: 0 1 320px; min-width: 200px; }
.list-filter-count { font-size: 13px; }
/* Intestazioni ordinabili */
table.data-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.data-table th.sortable::after { content: "↕"; margin-left: 5px; opacity: 0.35; font-size: 11px; }
table.data-table th.sortable[aria-sort="ascending"]::after { content: "↑"; opacity: 0.9; }
table.data-table th.sortable[aria-sort="descending"]::after { content: "↓"; opacity: 0.9; }
table.data-table th.sortable:hover { color: var(--text); }
@media (prefers-reduced-motion: reduce) { button.is-saving::before { animation: none; } }
.ore-preview { margin: 12px 0 0; font-weight: 600; color: var(--brand-dark); }
.ore-preview.warn { color: #8a5a00; }

/* ==========================================================================
   Ritocchi delle pagine interne (ufficio)
   ========================================================================== */
/* Link nel contenuto: colori dell'app invece del blu del browser */
/* Solo i link "semplici" (senza classe): pulsanti, schede e riepiloghi hanno il loro stile */
main a:not([class]) { color: var(--brand-dark); text-decoration-color: color-mix(in srgb, var(--brand) 35%, transparent); text-underline-offset: 2px; }
main a:not([class]):hover { color: var(--brand); text-decoration-color: currentColor; }
table.data-table td > a:not(.btn):first-child { font-weight: 600; text-decoration: none; }
table.data-table td > a:not(.btn):first-child:hover { text-decoration: underline; }

/* Elenco vuoto: messaggio centrato e leggibile, non una riga grigia schiacciata */
table.data-table td[colspan].muted, table.data-table tr > td[colspan]:only-child {
  text-align: center; padding: 26px 16px; color: var(--muted); font-size: 0.95em; background: #fafbfa;
}

/* Stati con colore coerente in tutta l'app: <span class="badge" data-st="APPROVATO"> */
.badge[data-st] { background: #eef1ef; color: #44514a; }
.badge[data-st="APPROVATO"], .badge[data-st="APPROVED"], .badge[data-st="RISOLTA"], .badge[data-st="ESEGUITO"],
.badge[data-st="CONTROLLATA"], .badge[data-st="INSERITA_GESTIONALE"], .badge[data-st="COMPILATO_UFFICIO"] {
  background: #dcefe0; color: #14542a;
}
.badge[data-st="INVIATO"], .badge[data-st="RICEVUTO"], .badge[data-st="PENDING"], .badge[data-st="APERTA"],
.badge[data-st="DA_CONTROLLARE"], .badge[data-st="VISTA"], .badge[data-st="REGISTRATO"], .badge[data-st="PROGRAMMATO"] {
  background: #e3edf7; color: #1f4e79;
}
.badge[data-st="IN_LAVORAZIONE"], .badge[data-st="CONTATTATO"], .badge[data-st="NORMALE"], .badge[data-st="MEDIA"] { background: #fdf0d2; color: #7a4f00; }
.badge[data-st="DA_CORREGGERE"], .badge[data-st="REJECTED"], .badge[data-st="URGENTE"], .badge[data-st="ALTA"] { background: #fbe1de; color: #9c2c22; }
.badge[data-st="ARCHIVIATO"], .badge[data-st="ARCHIVIATA"], .badge[data-st="ANNULLATO"], .badge[data-st="BASSA"], .badge[data-st="MANCANTE"] {
  background: #eceeed; color: #5f6a64;
}

/* Riepilogo numerico in testa a una pagina (rapporti, sopralluoghi…) */
.summary-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.summary-item {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 14px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; color: var(--muted); text-decoration: none;
}
.summary-item strong { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
a.summary-item:hover { border-color: var(--brand); }
.summary-item.is-warn strong { color: #9c2c22; }
.summary-item.is-ok strong { color: #14542a; }
button.summary-item { cursor: pointer; font: inherit; font-size: 13px; }
button.summary-item[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }

/* Scheda dati (cantiere): coppie etichetta / valore in griglia */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 20px; margin: 0; }
.info-grid div { min-width: 0; }
.info-grid dt { font-size: 12px; color: var(--muted); margin: 0 0 2px; }
.info-grid dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.info-grid dd.empty { color: var(--muted); font-weight: 400; }

/* Pannello "Nuovo …" richiudibile sopra un elenco */
details.new-panel { margin-bottom: 18px; }
details.new-panel > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 600; border-radius: calc(var(--radius) * 0.7);
  padding: calc(var(--density) * 0.7) 14px; font-size: 0.93em;
}
details.new-panel > summary::-webkit-details-marker { display: none; }
details.new-panel[open] > summary { background: transparent; color: var(--text); border: 1px solid var(--border); margin-bottom: 10px; }
details.new-panel[open] > summary .when-closed, details.new-panel:not([open]) > summary .when-open { display: none; }

/* Riga in evidenza in una tabella (es. rapporto mancante) */
table.data-table tr.row-missing td:first-child { box-shadow: inset 3px 0 0 #e0b252; }
/* Scheda cantiere: dati + attività affiancati sugli schermi larghi */
.site-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.site-desc { margin: 12px 0 0; white-space: pre-wrap; font-size: 0.95em; }
@media (max-width: 1100px) { .site-top { grid-template-columns: 1fr; } }
.code-chip { font-variant-numeric: tabular-nums; margin: 1px 4px 1px 0; font-weight: 600; }
/* Salto a una sezione (indice in cima alla pagina): la sezione si illumina un attimo */
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
.import-card:target, h2:target { animation: vc-target 1.6s ease; }
@keyframes vc-target { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); } 100% { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .import-card:target, h2:target { animation: none; } }

/* ==========================================================================
   Ufficio da smartphone
   ========================================================================== */
.bottom-nav { display: none; }
.dn-long { }

@media (max-width: 720px) {
  /* Campi a 16px: iPhone non fa lo zoom automatico quando si tocca un campo */
  input, select, textarea, .ss-input { font-size: 16px; }

  /* Barra in basso con le sezioni più usate */
  body.role-admin .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: #10200f; border-top: 1px solid rgba(255,255,255,0.08);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0,0,0,0.18);
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; border: 0; background: transparent; border-radius: 10px;
    color: #c7d6cb; font-size: 11px; font-weight: 600; text-decoration: none; position: relative;
    min-height: 48px; justify-content: center;
  }
  .bottom-nav .bn-ic { font-size: 19px; line-height: 1; }
  .bottom-nav a.active { color: #fff; background: rgba(255,255,255,0.08); }
  .bottom-nav a.active::before {
    content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: #8fd19e;
  }
  .bottom-nav .badge-dot { position: absolute; top: 3px; right: calc(50% - 22px); margin: 0; }
  body.role-admin { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.role-admin .vc-toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  html.in-frame .bottom-nav { display: none !important; }
  html.in-frame body.role-admin { padding-bottom: 0; }

  /* Barra in alto più leggera: la Dashboard è già in basso */
  .topbar .brand-logo { height: 26px; }

  /* Barra dei giorni: frecce compatte, data al centro, calendario sotto */
  .day-bar { display: block; }
  .day-nav { display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: center; margin-bottom: 10px; }
  .day-nav .dn-long { display: none; }
  .day-nav .dn-prev, .day-nav .dn-next { justify-content: center; padding: 8px 0; font-size: 18px; }
  .day-nav .day-nav-date { justify-content: center; text-align: center; flex-wrap: wrap; gap: 4px 8px; padding: 0; }
  .day-nav .day-nav-date strong { font-size: 16px; }
  .day-nav .day-nav-pick { grid-column: 1 / -1; }
  .day-nav .day-nav-pick input { width: 100%; }
  .day-nav .dn-today { grid-column: 1 / -1; justify-content: center; }
  .day-bar > .spacer { display: none; }
  .day-bar > .btn, .day-bar > .badge { margin: 0 6px 8px 0; }

  /* Intestazione pagina: titolo compatto, pulsanti in fila */
  .page-header { margin-bottom: 12px; }
  .page-header h1 { font-size: 20px; }
  .page-header > .toolbar { width: 100%; }
  .page-header > .toolbar .btn, .page-header > .toolbar button { flex: 1 1 auto; justify-content: center; }

  /* Tabelle trasformate in schede: la prima cella fa da titolo della scheda */
  table.data-table td:first-child {
    justify-content: flex-start; text-align: left; font-weight: 700; font-size: 15.5px;
    background: #fafbfa; border-radius: var(--radius) var(--radius) 0 0;
  }
  table.data-table td:first-child::before { content: none; }
  /* Azioni della scheda: pulsanti affiancati, larghi da toccare */
  table.data-table td.actions { flex-wrap: wrap; gap: 6px; }
  table.data-table td.actions > * { flex: 1 1 0; min-width: 96px; }
  table.data-table td.actions > .btn, table.data-table td.actions form button { justify-content: center; }
  table.data-table td.actions form { display: flex !important; }
  table.data-table td.actions form > button, table.data-table td.actions form > .btn { flex: 1 1 auto; }
  table.data-table td.actions form > select { flex: 1 1 100%; }
  .code-chip { white-space: nowrap; }

  /* Riepiloghi e filtri */
  .summary-strip { gap: 6px; }
  .summary-item { padding: 6px 11px; }
  .list-filter-input { flex: 1 1 100%; }
  .dash-stats { gap: 6px; }
  .dash-stat { padding: 5px 10px; font-size: 12px; }

  /* Scheda cantiere: dati su due colonne */
  .info-grid { grid-template-columns: 1fr 1fr; gap: 10px 14px; }

  /* Moduli lunghi: il pulsante Salva resta sempre in vista in fondo allo schermo */
  form.card > .toolbar:last-child, form > .toolbar:last-child:has(button[type="submit"]) {
    position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 20;
    background: var(--card-bg); margin-top: 14px; padding: 10px 12px;
    border-top: 1px solid var(--border); box-shadow: 0 -6px 14px rgba(0,0,0,0.06);
    border-radius: 0 0 var(--radius) var(--radius);
  }
  /* Dentro una scheda la barra arriva fino ai bordi */
  form.card > .toolbar:last-child { margin: 14px -24px -24px; padding: 10px 24px; }
  body.role-operator form.card > .toolbar:last-child,
  body.role-operator form > .toolbar:last-child:has(button[type="submit"]) { bottom: 0; }
  form > .toolbar:last-child button[type="submit"] { flex: 1 1 auto; justify-content: center; min-height: 44px; }
}

/* Filtro a schede (Tutti / Solo Vivaio / Solo Area Verde) */
.seg-tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin: 0 0 12px; background: var(--card-bg); }
.seg-tabs a { padding: 8px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; border-right: 1px solid var(--border); }
.seg-tabs a:last-child { border-right: 0; }
.seg-tabs a:hover { color: var(--text); background: #f4f6f4; }
.seg-tabs a.on { background: var(--brand); color: #fff; }
.cell-note { display: block; font-size: 12px; font-weight: 400; }
.badge[data-st="ASSENTE"] { background: #e9e4f3; color: #4b3b78; }
.area-note { margin: 8px 0 0; padding: 8px 10px; background: #f3f6f4; border-left: 3px solid var(--brand); font-size: 13.5px; }
/* Componenti squadra (rapporto): ricerca sopra l'elenco */
.team-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.team-count { font-size: 12.5px; font-weight: 600; }
.team-search { width: 100%; margin: 6px 0 4px; }
.team-list { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.team-item { padding: 4px 2px; }
/* Input Vivaio / Input AV: ricerca + export periodo */
.quadro-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 12px; }
.export-periodo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; }
.export-periodo .export-label { font-weight: 700; font-size: 13.5px; }
.export-periodo label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.export-periodo input[type=date] { padding: 5px 8px; }

/* ==========================================================================
   Stile sobrio da gestionale (05/10/2026, richiesta ufficio): angoli appena
   smussati invece che arrotondati, etichette a rettangolo invece che a pillola,
   intestazioni in minuscolo normale invece che in MAIUSCOLETTO.
   Questo blocco sta in fondo apposta: sovrascrive le regole sopra.
   ========================================================================== */
:root { --radius: 4px; }
body.role-admin { --radius: 4px; }
body.role-operator { --radius: 6px; }

.badge { border-radius: 3px; padding: 2px 7px; font-weight: 600; letter-spacing: 0; }
.summary-item, .dash-stat, .lang-switch .lang-flag, .nc-extra, .ms-chip, .vc-toast, .offline-toast,
.seg-tabs, .export-periodo, .team-list, .ss-list, .ms-panel, .ms-field, .qr-reader, .cal-cell, .row-card,
.dash-group, .action-card, .action-card.dash-tile, .dash-tile .ic, .ws-tab, .ws-btn, .sidebar a, .sidebar-search,
.bottom-nav a, .bottom-nav button, .info-grid, .area-note, details.new-panel > summary, .stat-tile, .table-wrap,
input, select, textarea, button, .btn { border-radius: var(--radius); }
.cal-modal-card { border-radius: 6px 6px 0 0; }
@media (min-width: 641px) { .cal-modal-card { border-radius: 6px; } }
main .sopr-card { border-radius: var(--radius); }

/* Icone dei moduli senza il riquadro colorato dietro */
.dash-tile .ic { background: none; width: 26px; height: 26px; font-size: 19px; }

/* Intestazioni e etichette in carattere normale (niente MAIUSCOLETTO spaziato) */
table.data-table th { text-transform: none; letter-spacing: 0; font-size: 12.5px; color: #4f5d52; }
.stat-tile .stat-label, .sidebar-title, .eyebrow, .cal-head { text-transform: none; letter-spacing: 0; }
.sidebar-title { font-size: 12px; font-weight: 600; }
@media (max-width: 720px) {
  table.data-table td::before { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
}

/* Riepiloghi come una riga di numeri, non come bollini */
.summary-strip { gap: 0; border: 1px solid var(--border); background: var(--card-bg); border-radius: var(--radius); width: fit-content; max-width: 100%; }
.summary-item { border: 0; border-right: 1px solid var(--border); border-radius: 0; background: transparent; padding: 8px 14px; }
.summary-item:last-child { border-right: 0; }
a.summary-item:hover, button.summary-item:hover { background: #f4f6f4; }
button.summary-item[aria-pressed="true"] { background: var(--brand-soft); }
@media (max-width: 720px) {
  .summary-strip { width: 100%; }
  .summary-item { flex: 1 1 auto; justify-content: center; padding: 7px 8px; }
}

/* Dashboard: il nome in grande, senza "Benvenuto"; numeri come testo semplice */
.dash-hello .dash-name { margin: 0; font-size: 30px; line-height: 1.15; letter-spacing: -0.01em; }
.dash-stat { border: 0; background: none; padding: 2px 0 2px 14px; border-left: 1px solid var(--border); border-radius: 0; }
.dash-stat:first-child { border-left: 0; padding-left: 0; }
@media (max-width: 720px) { .dash-hello .dash-name { font-size: 24px; } }

/* Scadenze mezzi */
.badge[data-st="SCADUTA"] { background: #fbe1de; color: #9c2c22; }
.badge[data-st="QUESTO_MESE"] { background: #fdecc8; color: #7a4f00; }
.badge[data-st="PROSSIMA"] { background: #e3edf7; color: #1f4e79; }
.badge[data-st="OK"] { background: #dcefe0; color: #14542a; }
table.data-table td.exp-scaduta { background: #fbe1de; color: #8c1d18; font-weight: 700; }
table.data-table td.exp-mese { background: #fdf0d2; color: #7a4f00; font-weight: 700; }
.dash-alert {
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin: 0 0 14px; padding: 10px 14px;
  background: #fdf0d2; border: 1px solid #ecd28f; border-left: 4px solid #c98a00; border-radius: var(--radius);
  color: #5c3c00; text-decoration: none;
}
.dash-alert:hover { background: #fbe8bd; }
.dash-alert span { font-size: 13.5px; }
details.inline-action { display: inline-block; text-align: left; vertical-align: top; }
details.inline-action > summary { list-style: none; cursor: pointer; }
details.inline-action > summary::-webkit-details-marker { display: none; }
details.inline-action[open] > summary { margin-bottom: 6px; }
.inline-form { margin: 0; padding: 10px; min-width: 240px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); }
/* Utilizzo mezzi: commessa proposta (da confermare) */
select.is-proposta { border-style: dashed; border-color: #c98a00; background: #fffaf0; font-style: italic; }
.proposta-note { color: #8a5a00; font-weight: 600; }
.mezzi-table select { max-width: 210px; }
.nota-input { width: 100%; min-width: 120px; }

/* Commessa: resoconto a schede */
.panel-title { font-size: 17px; margin: 6px 0 10px; }
.detail-title { font-size: 14px; margin: 16px 0 8px; color: var(--muted); font-weight: 700; }
table.data-table.riepilogo { width: auto; min-width: 50%; }
table.data-table.riepilogo th:first-child { color: var(--text); }
.print-only { display: none; }
@media print {
  .topbar, .sidebar, .bottom-nav, .env-banner, .no-print, .offline-bar, .vc-toast, .list-filter { display: none !important; }
  .print-only { display: block; }
  body, .app-body, main { background: #fff !important; padding: 0 !important; }
  .table-wrap { border: 0; overflow: visible; }
  table.data-table { font-size: 11px; }
  .tab-panel { break-inside: auto; margin-bottom: 18px; }
  .tab-panel[hidden] { display: block !important; }
}

/* ==========================================================================
   Tabelle a griglia (05/10/2026, richiesta ufficio): bordi anche interni, così si
   vede subito a che riga e colonna appartiene un dato; numeri centrati nella colonna.
   Solo su schermi larghi: sul telefono le righe diventano schede.
   ========================================================================== */
table.data-table td.num, table.data-table th.num { text-align: center; }
@media (min-width: 721px) {
  table.data-table { border-collapse: collapse; }
  table.data-table th, table.data-table td { border: 1px solid var(--border); }
  table.data-table thead th { border-bottom: 2px solid #c9d3cb; }
  .table-wrap > table.data-table { border-style: hidden; } /* il bordo esterno lo dà già il riquadro */
  table.data-table tbody tr:nth-child(even) td { background-color: #fafbfa; }
  table.data-table tbody tr:hover td { background-color: var(--brand-soft); }
  .qv-table th, .qv-table td { border-right: 1px solid var(--border); }
}
.qv-footer.qv-footer-static { position: static; box-shadow: none; }

/* ==========================================================================
   Rapporto guidato (modalità semplice operatori): una domanda alla volta,
   testi grandi, bottoni alti almeno 64px, niente tendine.
   ========================================================================== */
.rg-main { max-width: 560px; margin: 0 auto; }
.rg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  color: var(--muted); font-size: 15px; margin: 0 2px 12px; }
.rg-head strong { color: var(--brand-dark); font-size: 16px; }
.rg-screen { background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px;
  padding: 20px 16px 18px; display: flex; flex-direction: column; gap: 12px; min-height: 60vh; }
.rg-q { font-size: 25px; line-height: 1.25; font-weight: 700; margin: 2px 0 4px; color: var(--text); }
.rg-sub { font-size: 17px; color: var(--muted); margin: -4px 0 4px; line-height: 1.4; }
.rg-card { background: var(--brand-soft); border-radius: 14px; padding: 16px; font-size: 20px; line-height: 1.35; }
.rg-card strong { display: block; font-size: 22px; color: var(--brand-dark); }
.rg-card .rg-tag { display: inline-block; font-size: 13px; color: var(--muted); margin-top: 6px; }
.rg-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 64px;
  padding: 12px 16px; border-radius: 14px; border: 2px solid var(--border); background: #fff; color: var(--text);
  font-size: 20px; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.rg-btn:active { transform: scale(0.98); }
.rg-btn .rg-ic { font-size: 26px; line-height: 1; }
.rg-btn.rg-yes, .rg-btn.rg-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.rg-btn.rg-no { background: #fff; border-color: #c9d3cb; }
.rg-btn.rg-sel { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.rg-btn.rg-big { min-height: 96px; font-size: 24px; }
.rg-btn.rg-small { min-height: 48px; font-size: 16px; font-weight: 500; }
.rg-btn.rg-left { justify-content: flex-start; text-align: left; }
.rg-btn[disabled] { opacity: 0.45; }
.rg-list { display: flex; flex-direction: column; gap: 10px; }
.rg-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rg-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rg-nums .rg-btn { min-height: 64px; font-size: 26px; padding: 0; }
.rg-hours-now { text-align: center; font-size: 40px; font-weight: 800; color: var(--brand-dark); margin: 0; }
.rg-hours-now small { font-size: 18px; font-weight: 600; color: var(--muted); }
.rg-total { text-align: center; color: var(--muted); font-size: 16px; }
.rg-search { font-size: 19px; min-height: 56px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--border); width: 100%; }
.rg-input { font-size: 26px; min-height: 64px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--brand); width: 100%; text-align: center; }
.rg-text { font-size: 18px; min-height: 96px; padding: 12px; border-radius: 12px; border: 2px solid var(--border); width: 100%; font-family: inherit; }
.rg-foot { display: flex; gap: 10px; margin-top: auto; padding-top: 8px; }
.rg-foot .rg-btn { flex: 1; }
.rg-back { background: none; border: none; color: var(--muted); font-size: 17px; padding: 10px 4px; cursor: pointer; align-self: flex-start; }
.rg-note { font-size: 15px; color: var(--muted); text-align: center; margin: 4px 0 0; }
.rg-err { color: #b42318; font-size: 17px; font-weight: 600; text-align: center; margin: 0; }
.rg-sum { display: flex; flex-direction: column; gap: 8px; }
.rg-sum-row { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; font-size: 18px; line-height: 1.35; }
.rg-sum-row .rg-h { font-weight: 800; color: var(--brand-dark); min-width: 64px; }
.rg-sum-row .rg-d { flex: 1; }
.rg-sum-row .rg-d small { display: block; color: var(--muted); font-size: 15px; }
.rg-sum-row button { flex: none; background: none; border: 1px solid #e3b4ae; color: #b42318; border-radius: 10px; padding: 8px 10px; font-size: 15px; }
.rg-rec { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rg-mic { width: 120px; height: 120px; border-radius: 50%; border: none; background: var(--brand); color: #fff; font-size: 48px; cursor: pointer; }
.rg-mic.rg-on { background: #c62828; animation: rg-pulse 1.2s infinite; }
@keyframes rg-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, .45); } 50% { box-shadow: 0 0 0 16px rgba(198, 40, 40, 0); } }
.rg-timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rg-rec audio { width: 100%; }
.rg-done { align-items: center; text-align: center; justify-content: center; }
.rg-check { width: 110px; height: 110px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 64px;
  display: flex; align-items: center; justify-content: center; margin: 8px auto; }
.rg-done h1 { font-size: 26px; margin: 4px 0; }
.rg-done p { font-size: 18px; color: var(--muted); margin: 0 0 8px; }
.rg-home-btn { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 110px; margin-bottom: 16px;
  border-radius: 18px; background: var(--brand); color: #fff; font-size: 24px; font-weight: 700; text-decoration: none; padding: 16px; }
.rg-home-btn .ic { font-size: 34px; }
@media (prefers-reduced-motion: reduce) { .rg-mic.rg-on { animation: none; } .rg-btn:active { transform: none; } }
.badge[data-st="IN_CORSO"] { background: #e3effa; color: #1d5a8c; }
.rg-ok { background: var(--brand-soft); color: var(--brand-dark); font-size: 19px; font-weight: 700; text-align: center;
  border-radius: 12px; padding: 12px; margin: 0; }
.rg-today { text-align: center; color: var(--muted); font-size: 16px; margin: -8px 0 16px; }
.rg-home-btn.rg-home-alt { background: #fff; color: var(--brand-dark); border: 2px solid var(--brand); min-height: 80px; font-size: 21px; }
/* Pulsanti del rapporto in home: nome + quando usarlo */
.rg-home-txt { display: flex; flex-direction: column; align-items: flex-start; text-align: left; line-height: 1.2; }
.rg-home-txt small { font-size: 15px; font-weight: 500; opacity: 0.85; margin-top: 4px; }
.rg-nums.rg-trip { grid-template-columns: repeat(2, 1fr); }
.rg-nums.rg-trip .rg-btn { font-size: 20px; }
.rg-warn { display: flex; flex-direction: column; gap: 4px; background: #fdf0d2; color: #7a4f00; border-radius: 12px; padding: 12px 14px; font-size: 17px; }
.rg-warn strong { font-size: 17px; }
.rg-btn small { font-weight: 500; }
.op-hello { font-size: 24px; margin: 4px 2px 14px; color: var(--brand-dark); }

/* Programma: contenitore "Già nel programma" sopra gli elenchi Dipendenti e Mezzi di ogni riga. */
.dp-used { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; padding: 6px 8px;
  background: #f6f8f6; border: 1px solid var(--border); border-radius: 6px; }
.dp-used-head { width: 100%; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.dp-used .dp-used-chip { font-size: 12px; line-height: 1.3; padding: 2px 8px; border-radius: 12px; cursor: pointer;
  border: 1px solid #cfd8d1; background: #fff; color: #44514a; font-family: inherit; font-weight: 400; text-decoration: none; margin: 0; }
.dp-used .dp-used-chip.mine { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.dp-used .dp-used-chip:hover { border-color: var(--brand); }

/* ============================================================
   Tocco e passaggi tra le pagine (mobile): risposta immediata
   ============================================================ */
html { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Pressione visibile su tutto ciò che si tocca (immediata, senza attese) */
.action-card:active, .btn:active, .seg-tabs a:active { transform: scale(0.97); }
.bottom-nav a:active, .bottom-nav button:active { background: rgba(255,255,255,0.14); }
.sidebar a:active { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.action-card:active { background: var(--brand-soft); border-color: var(--brand); }
.action-card.dash-tile:active { background: color-mix(in srgb, var(--cat) 10%, #fff); border-color: var(--cat); }

/* Barra di caricamento in alto: parte al tocco, avanza veloce e poi rallenta finché arriva la pagina */
.vc-navbar { position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 9999; pointer-events: none;
  transform-origin: 0 50%; transform: scaleX(0); opacity: 0;
  background: linear-gradient(90deg, #8fd19e, #fff 60%, #8fd19e); box-shadow: 0 0 6px rgba(143,209,158,0.8); }
.vc-navbar.run { opacity: 1; animation: vc-navbar-go 6s cubic-bezier(0.1, 0.8, 0.2, 1) forwards; }
.vc-navbar.done { transform: scaleX(1); opacity: 0; transition: opacity 0.25s ease 0.05s; animation: none; }
@keyframes vc-navbar-go { 0% { transform: scaleX(0); } 10% { transform: scaleX(0.45); } 100% { transform: scaleX(0.92); } }

/* Passaggio morbido tra una pagina e l'altra (Chrome/Android e Safari recenti): barra e menù restano fermi */
@view-transition { navigation: auto; }
.topbar { view-transition-name: vc-topbar; }
.bottom-nav { view-transition-name: vc-bottomnav; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.14s; animation-timing-function: ease-out; }

@media (prefers-reduced-motion: reduce) {
  .action-card:active, .btn:active, .seg-tabs a:active { transform: none; }
  .vc-navbar.run { animation: none; transform: scaleX(0.6); }
  @view-transition { navigation: none; }
}
.badge.badge-ufficio { background: #e9e4f3; color: #4b3b78; }
.invio { font-size: 13px; }
/* Statistiche utilizzo app */
.aut { display: inline-block; min-width: 46px; padding: 2px 6px; border-radius: 10px; font-weight: 700; font-size: 13px; text-align: center; }
.aut-ok { background: #dcefe0; color: #1f6532; }
.aut-medio { background: #fdf0d2; color: #7a4f00; }
.aut-basso { background: #fbe1de; color: #9c2c22; }
.stat-table tfoot th { background: #f3f6f4; }

/* ==========================================================================
   Commerciale: merce da ritirare, da consegnare, preventivi.
   Il nastro (--nastro) è il colore del venditore, lo stesso legato alle piante in vivaio.
   ========================================================================== */
.badge[data-st="DA_FARE"] { background: #fdf0d2; color: #7a4f00; }
.badge[data-st="IN_PARTE"] { background: #ffe1c7; color: #8a3d00; }

.comm-nav { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--border); margin: 0 0 16px; }
.comm-nav a { padding: 10px 14px 9px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent;
  margin-bottom: -2px; border-radius: 6px 6px 0 0; }
.comm-nav a:hover { color: var(--text); background: color-mix(in srgb, var(--cat-commerciale) 6%, transparent); }
.comm-nav a[aria-current="page"] { color: var(--cat-commerciale); border-bottom-color: var(--cat-commerciale); }

.comm-filtri { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.comm-filtri a { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card-bg); color: var(--muted); font-size: 13px; text-decoration: none; }
.comm-filtri a strong { color: var(--text); font-variant-numeric: tabular-nums; }
.comm-filtri a[aria-current="true"] { border-color: var(--cat-commerciale); background: color-mix(in srgb, var(--cat-commerciale) 9%, var(--card-bg));
  color: var(--text); }

/* Il nastro: una fascetta a strisce verticali colore/nero col capo tagliato a coda di rondine */
.nastro { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; }
.nastro::before { content: ""; flex: none; width: 26px; height: 12px;
  background: repeating-linear-gradient(to right, var(--nastro, #c9d3cb) 0 4px, #000 4px 7px);
  clip-path: polygon(0 0, 100% 0, 78% 50%, 100% 100%, 0 100%); box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.nastro.vuoto { color: var(--muted); }
.nastro.vuoto::before { background: repeating-linear-gradient(45deg, #dfe6e0 0 3px, #fff 3px 6px); }
table.data-table tr[data-nastro] td:first-child { box-shadow: inset 1px 0 0 #b8c2bb, inset 4px 0 0 var(--nastro), inset 7px 0 0 #000; }

.comm-num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.comm-cliente { font-weight: 600; }
.comm-sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.comm-eur { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.comm-resto { color: #9c2c22; font-weight: 700; }

/* Barra "quante piante sono uscite" */
.comm-prog { display: grid; gap: 3px; min-width: 110px; font-size: 12.5px; }
.comm-prog-bar { height: 6px; border-radius: 3px; background: #e6ebe7; overflow: hidden; }
.comm-prog-bar span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

.comm-empty { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); background: var(--card-bg); }
.comm-empty .btn { margin-top: 10px; }

/* Modulo */
.comm-form { display: grid; gap: 16px; max-width: 1100px; }
.comm-form fieldset { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); padding: 14px 16px 16px; margin: 0; min-width: 0; }
.comm-form legend { font-weight: 700; padding: 0 6px; margin-left: -6px; }
.comm-tipo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.comm-tipo label { position: relative; display: grid; gap: 2px; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--card-bg); cursor: pointer; }
.comm-tipo label small { color: var(--muted); font-size: 12.5px; }
.comm-tipo input { position: absolute; opacity: 0; pointer-events: none; }
.comm-tipo label:has(input:checked) { border-color: var(--cat-commerciale); box-shadow: 0 0 0 1px var(--cat-commerciale) inset;
  background: color-mix(in srgb, var(--cat-commerciale) 6%, var(--card-bg)); }
.comm-tipo label:has(input:focus-visible) { outline: 2px solid var(--cat-commerciale); outline-offset: 2px; }
.comm-tipo label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.comm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 14px; }
.comm-form [hidden] { display: none !important; }
.comm-grid label { display: grid; gap: 4px; align-content: start; font-size: 13px; font-weight: 600; min-width: 0; }
.comm-grid label.wide { grid-column: 1 / -1; }
.comm-grid .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.comm-venditori { display: flex; flex-wrap: wrap; gap: 6px; }
.comm-venditori label { display: inline-flex; align-items: center; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
  font-weight: 500; background: var(--card-bg); }
.comm-venditori input { position: absolute; opacity: 0; pointer-events: none; }
.comm-venditori label:has(input:checked) { border-color: var(--text); background: #f3f5f3; font-weight: 700; }
.comm-venditori label:has(input:focus-visible) { outline: 2px solid var(--cat-commerciale); outline-offset: 2px; }

.comm-righe { width: 100%; border-collapse: collapse; font-size: 14px; }
.comm-righe th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 6px 6px; white-space: nowrap; }
.comm-righe td { padding: 4px 6px; vertical-align: middle; border-top: 1px solid var(--border); }
.comm-righe input { width: 100%; min-width: 0; padding: 7px 8px; }
.comm-righe .c-cod { width: 130px; } .comm-righe .c-q { width: 78px; } .comm-righe .c-u { width: 64px; }
.comm-righe .c-p { width: 104px; } .comm-righe .c-tot { width: 96px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.comm-righe .c-sub { width: 92px; } .comm-righe .c-x { width: 40px; text-align: right; }
.comm-righe tr.servizio td { background: #f6f8fb; }
.comm-righe tr.servizio .c-cod::before { content: "Servizio"; display: block; font-size: 11px; color: #1f4e79; font-weight: 700; margin-bottom: 2px; }
.comm-righe .riga-x { border: 0; background: transparent; color: var(--muted); font-size: 18px; padding: 4px 8px; min-height: 0; }
.comm-righe .riga-x:hover { color: #b3261e; }
.comm-righe .uscite { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.comm-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.comm-pagamento { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.comm-pagamento > label { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }

.comm-footer { position: sticky; bottom: 0; z-index: 4; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between;
  padding: 12px 16px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 -4px 14px rgba(0,0,0,.06); }
.comm-totale { display: grid; line-height: 1.15; }
.comm-totale small { color: var(--muted); font-size: 12.5px; }
.comm-totale strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.comm-errori { border: 1px solid #e6b6b0; background: #fdf1ef; color: #8c2219; border-radius: var(--radius); padding: 10px 14px 10px 32px; margin: 0; }

/* Scheda */
.comm-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.comm-head h1 { margin: 0; font-size: 24px; }
.comm-head .comm-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.comm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.comm-layout > div { display: grid; gap: 16px; min-width: 0; }
.comm-box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); padding: 14px 16px; }
.comm-box h2 { font-size: 15px; margin: 0 0 10px; }
.comm-conti { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-variant-numeric: tabular-nums; }
.comm-conti dt { color: var(--muted); }
.comm-conti dd { margin: 0; text-align: right; font-weight: 600; }
.comm-conti .tot { font-size: 18px; font-weight: 800; color: var(--text); border-top: 1px solid var(--border); padding-top: 6px; }
.comm-conti .resto { color: #9c2c22; font-size: 16px; font-weight: 800; }
.comm-conti .ok { color: #14542a; font-weight: 800; }
.comm-azione { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); }
.comm-azione > summary { list-style: none; cursor: pointer; padding: 11px 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.comm-azione > summary::-webkit-details-marker { display: none; }
.comm-azione > summary::after { content: "+"; margin-left: auto; color: var(--muted); font-weight: 400; font-size: 18px; }
.comm-azione[open] > summary::after { content: "–"; }
.comm-azione > form, .comm-azione > div { padding: 0 14px 14px; }
.comm-azione.principale { border-color: var(--cat-commerciale); }
.comm-azione.principale > summary { color: var(--cat-commerciale); }
.comm-storia { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.comm-storia li { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; border-top: 1px solid var(--border); padding-top: 8px; }
.comm-storia li:first-child { border-top: 0; padding-top: 0; }
.comm-storia .chi { color: var(--muted); font-size: 12.5px; }
.comm-uscita-q { width: 84px; padding: 6px 8px; text-align: right; }
.comm-note { white-space: pre-wrap; margin: 0; }

@media (max-width: 900px) {
  .comm-layout { grid-template-columns: 1fr; }
  .comm-tipo { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  /* Righe del modulo come piccole schede impilate */
  .comm-righe thead { display: none; }
  .comm-righe, .comm-righe tbody, .comm-righe tr { display: block; }
  .comm-righe tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 10px 0; border-top: 1px solid var(--border); }
  .comm-righe td { display: block; border: 0; padding: 0; width: auto !important; }
  .comm-righe td.c-desc { grid-column: 1 / -1; order: -1; }
  .comm-righe td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  .comm-righe td.c-tot { align-self: end; padding-bottom: 8px; }
  .comm-footer .comm-totale strong { font-size: 20px; }
}
@media (max-width: 720px) {
  /* sopra la barra in basso dell'ufficio */
  body.role-admin .comm-footer { bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 12px; }
  .comm-footer .toolbar .btn { display: none; }
  .comm-add-hint { display: none; }
}

/* ==========================================================================
   Rapporto d'ufficio (usa anche le righe e la barra del totale del Commerciale)
   ========================================================================== */
.uf-giorno { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 0 0 14px; }
.uf-data { display: inline-flex; flex-direction: column; gap: 2px; }
.uf-data strong { font-size: 16px; }
.uf-data input { padding: 4px 8px; font-size: 13px; max-width: 170px; }
.uf-righe .uf-centro { width: 210px; } .uf-righe .uf-commessa { width: 170px; }
.uf-righe select { width: 100%; padding: 7px 6px; }
.uf-filtri { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 14px; }
.uf-filtri label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.uf-rapidi { display: inline-flex; gap: 12px; font-size: 13px; padding-bottom: 8px; }
table.uf-centri th small.uf-centro-nome { display: block; font-weight: 400; font-size: 11px; color: var(--muted); white-space: nowrap; }
table.uf-centri tfoot td { font-weight: 700; background: #f4f6f4; }
table.uf-centri tr.uf-perc td { font-weight: 400; color: var(--muted); font-size: 12.5px; }
@media (max-width: 760px) {
  .uf-righe .uf-centro, .uf-righe .uf-commessa { width: auto !important; }
  .uf-righe tr { grid-template-columns: 1fr 1fr; }
}

/* ===== Domande per lavorazione (anagrafica) ===== */
#dm-form { max-width: 1000px; }
.dm-oggi { font-size: 13px; margin: 0 0 14px; }
.dm-oggi a { margin-left: 6px; font-size: 12.5px; }
.dm-domanda { margin-bottom: 12px; padding: 14px 16px; }
.dm-domanda [hidden], .dm-vuoto[hidden] { display: none !important; }
.dm-testa { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.dm-testa label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; margin: 0; }
.dm-testo { flex: 1 1 280px; }
.dm-obbl { flex-direction: row !important; align-items: center; gap: 6px !important; padding-bottom: 8px; font-weight: 400 !important; }
.dm-obbl input { width: auto; }
.dm-num { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.dm-azioni { display: inline-flex; gap: 4px; margin-left: auto; padding-bottom: 4px; }
.dm-opzioni { margin-top: 12px; }
.dm-tab { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 13px; }
.dm-tab th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 4px 6px; }
.dm-tab td { padding: 3px 6px; vertical-align: top; }
.dm-tab td input[type="text"] { width: 100%; }
.dm-tab td:first-child { width: 42%; }
.dm-dest { display: flex; flex-wrap: wrap; gap: 6px; }
.dm-dest select { max-width: 100%; }
.dm-tab .riga-x { border: 0; background: transparent; color: var(--muted); font-size: 18px; padding: 4px 8px; min-height: 0; }
.dm-tab .riga-x:hover { color: #b3261e; }
.dm-info { font-size: 13px; margin: 10px 0 0; }
@media (max-width: 760px) {
  .dm-tab thead { display: none; }
  .dm-tab tr { display: grid; grid-template-columns: 1fr auto; gap: 4px; border-bottom: 1px solid var(--border); padding: 6px 0; }
  .dm-tab td.dm-dest { grid-column: 1 / -1; grid-row: 2; }
  .dm-azioni { margin-left: 0; }
}
/* Input Vivaio: riga con domande obbligatorie senza risposta */
.qv-table tbody tr.qv-giallo td { background: #fff4c2; }
.qv-table tbody tr.qv-giallo .qv-nota { color: #8a5a00; font-weight: 600; }
.qv-completato { margin-top: 4px; padding: 1px 7px !important; min-height: 0 !important; font-size: 11px !important; }
.wr-risposte { margin: 0; font-size: 13px; color: var(--muted); }
