html {
  height: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "DM Sans", -apple-system, "Segoe UI", Arial, Helvetica, sans-serif;
  background: #f1f5f9;
  color: #1f2937;
  font-size: 14px;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 30px;
  background: white;
  border-bottom: 1px solid #dbe3ea;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.topbar-left h1 {
  margin: 0;
  font-size: 28px;
  color: #1e40af;
}

.topbar-left p {
  margin: 6px 0 0 0;
  color: #6b7280;
  font-size: 15px;
}

.badge {
  display: inline-block;
  padding: 8px 14px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 999px;
  font-size: 14px;
  font-weight: bold;
}

.page {
  max-width: 100%;
  margin: 0;
  padding: 0;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* ==============================
   SIDEBAR LAYOUT
============================== */
.dvr-layout {
  display: flex;
  height: 100%;
}

.sidebar {
  width: 200px;
  min-width: 200px;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 6px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: rgba(255,255,255,0.6);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  height: auto;
  line-height: 1.3;
  border-radius: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}

.nav-btn.active {
  background: rgba(59, 130, 246, 0.18);
  border-left-color: #3b82f6;
  color: #93c5fd;
  font-weight: 700;
}

.nav-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.nav-label {
  flex: 1;
}

.sidebar-actions {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-action-btn {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  height: auto;
  line-height: 1.4;
  text-align: left;
}

.sidebar-save {
  background: #1e40af;
  color: #fff;
}

.sidebar-save:hover { background: #1d4ed8; }

.sidebar-open {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
}

.sidebar-open:hover { background: rgba(255,255,255,0.14); }

.sidebar-delete {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.sidebar-delete:hover { background: rgba(239, 68, 68, 0.25); }

.dvr-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 32px;
  min-width: 0;
}

.card {
  background: #ffffff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  margin-bottom: 10px;
  border: 1px solid #e4eaf0;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #1a3a5c;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group-full {
  grid-column: 1 / -1;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 13px;
  color: #374151;
}

input,
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #c8d6e5;
  border-radius: 6px;
  font-size: 14px;
  background: white;
}

input:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

button {
  padding: 0 16px;
  height: 36px;
  font-size: 13px;
  font-weight: 600;
  background: #1a3a5c;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

button:hover {
  background: #14304d;
}

.btn-secondary {
  background: #5a6e82;
  color: #fff;
}

.btn-secondary:hover {
  background: #475d72;
}

.btn-danger {
  background: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-export {
  background: #2d7a4f;
  font-size: 13px;
  height: 36px;
  padding: 0 14px;
}

.btn-export:hover {
  background: #256040;
}

.btn-primary {
  background: #2563eb;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.photos-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.photo-item {
  background: #f8fafc;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  padding: 12px;
  text-align: left;
}

.photo-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 10px;
}

.photo-title {
  font-size: 14px;
  font-weight: bold;
  word-break: break-word;
}

.empty-message {
  color: #6b7280;
  font-size: 15px;
  margin: 0;
}

.result-box {
  min-height: 80px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
}

.result-box h3 {
  margin-top: 0;
}

.saved-projects {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.allegati-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.allegato-row {
  display: grid;
  grid-template-columns: 90px 1fr minmax(240px, 320px) 170px;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  background: #f8fafc;
}

.allegato-preview {
  width: 90px;
  height: 90px;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.allegato-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.allegato-icon {
  font-size: 12px;
  font-weight: bold;
  color: #1d4ed8;
  text-align: center;
  padding: 6px;
}

.allegato-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 6px;
  word-break: break-word;
}

.allegato-meta {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}

.allegato-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.allegato-fields label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 0;
}

.allegato-fields select,
.allegato-fields input {
  margin-top: 4px;
  padding: 8px;
  font-size: 13px;
}

.allegato-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.allegato-actions button {
  padding: 9px 10px;
  font-size: 13px;
}

.project-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  background: #f8fafc;
}

.project-info {
  flex: 1;
}

.project-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 4px;
}

.project-meta {
  font-size: 14px;
  color: #6b7280;
}

.project-meta-small {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 6px;
}

.project-date {
  color: #6366f1;
  font-weight: 500;
}

.project-search-box {
  margin-bottom: 16px;
}

.project-search-box input {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  border: 2px solid #dbe3ea;
  border-radius: 10px;
  transition: 0.2s ease;
}

.project-search-box input:focus {
  outline: none;
  border-color: #2563eb;
}

.project-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.project-actions button {
  padding: 9px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.quick-actions button {
  padding: 9px 14px;
  font-size: 14px;
  width: auto;
}

.selected-box {
  min-height: 50px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.selected-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 999px;
  font-size: 14px;
  font-weight: bold;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-content {
  position: relative;
  z-index: 2;
  width: min(1000px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  overflow: auto;
  margin: 30px auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  padding: 22px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-header h3 {
  margin: 0;
  font-size: 24px;
}

.modal-close {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.modal-close:hover {
  background: #dc2626;
}

.luoghi-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.luogo-tile {
  border: 2px solid #dbe3ea;
  border-radius: 12px;
  background: #f8fafc;
  padding: 16px;
  cursor: pointer;
  transition: 0.2s ease;
  min-height: 110px;
}

.luogo-tile:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.luogo-tile.selected {
  border-color: #2563eb;
  background: #dbeafe;
}

.luogo-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.luogo-tile-title {
  font-size: 16px;
  font-weight: bold;
  color: #111827;
  line-height: 1.3;
}

.luogo-tile-cross {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  background: white;
  flex-shrink: 0;
}

.luogo-tile.selected .luogo-tile-cross {
  border-color: #2563eb;
  background: #2563eb;
}

.luogo-tile-meta {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.manual-box {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  background: #f8fafc;
}

.manual-box.hidden {
  display: none;
}

.manual-box label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

.manual-box input {
  width: 100%;
}

.manual-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.manual-row input {
  flex: 1;
}

.manual-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.manual-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #e5e7eb;
  color: #111827;
  border-radius: 999px;
  font-size: 14px;
  font-weight: bold;
}

.manual-chip button {
  border: none;
  background: #ef4444;
  color: white;
  border-radius: 999px;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 12px;
  cursor: pointer;
}

.manual-chip button:hover {
  background: #dc2626;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.search-box {
  margin-bottom: 15px;
}

.search-box input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.search-box input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-actions {
    width: 100%;
  }

  .allegato-row {
    grid-template-columns: 80px 1fr;
  }

  .allegato-fields,
  .allegato-actions {
    grid-column: 1 / -1;
  }

  .allegato-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 700px) {
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-content {
    width: calc(100vw - 20px);
    margin: 10px auto;
    max-height: calc(100vh - 20px);
    padding: 16px;
  }

  .luoghi-modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-actions button,
  .section-head button {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 0 12px 30px 12px;
  }

  .card {
    padding: 18px;
  }

  .topbar {
    padding: 18px 16px;
  }

  .topbar-left h1 {
    font-size: 24px;
  }

  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .quick-actions button {
    width: 100%;
  }

  .photo-item img {
    height: 160px;
  }

  .project-actions {
    flex-direction: column;
  }

  .project-actions button {
    width: 100%;
  }

  .manual-row {
    flex-direction: column;
  }
}

/* ── LUOGHI PER MANSIONE – griglia 2 colonne ── */
.compat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 900px) {
  .compat-grid { grid-template-columns: 1fr; }
}
.compat-card {
  display: block;
  margin-bottom: 0;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.compat-card-title {
  display: block;
  background: #0f2744;
  color: white;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
}
.compat-tags { display: contents; }
.compat-tag { display: none; }

/* Rimuove il padding del selected-box per la tabella luoghi */
#luoghiCompatibiliBox {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  min-height: unset;
}

/* ── LUOGHI GRID – Tab Luoghi di Lavoro ── */
.luoghi-categoria {
  margin-bottom: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}
.luoghi-cat-header {
  background: #1e3a5f;
  color: white;
  padding: 6px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.luoghi-cat-header:hover { background: #2d5a8e; }
.luoghi-cat-header .cat-label { display: flex; align-items: center; gap: 6px; }
.luoghi-cat-header .cat-toggle { font-size: 9px; opacity: 0.8; }
.luoghi-cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  background: white;
}
.luogo-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-bottom: 1px solid #f8fafc;
  border-right: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.1s;
  min-height: 34px;
}
.luogo-item:nth-child(3n) { border-right: none; }
.luogo-item:hover { background: #f0f4f8; }
.luogo-item.selected {
  background: #eff6ff;
  border-left: 2px solid #1e3a5f;
  padding-left: 8px;
}
.luogo-item input[type=checkbox] {
  width: 13px; height: 13px;
  accent-color: #1e3a5f;
  flex-shrink: 0;
  cursor: pointer;
  pointer-events: none;
}
.luogo-item .luogo-icon {
  font-size: 13px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  line-height: 1;
}
.luogo-item .luogo-nome {
  font-size: 11px;
  color: #374151;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.luogo-item.selected .luogo-nome {
  color: #1e3a5f;
  font-weight: 500;
}

/* ── LUOGHI TABLE – Sezione 3 compatta ── */
.luoghi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.luoghi-table th {
  background: #1e3a5f;
  color: white;
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.luoghi-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.luoghi-table tr:hover td {
  background: #f8fafc;
}

/* ── LUOGO CHIP TOGGLE – preset luoghi (inactive = grey, active = blue) ── */
.luogo-chip-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  margin: 2px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #94a3b8;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  user-select: none;
}
.luogo-chip-toggle:hover {
  border-color: #93c5fd;
  color: #3b82f6;
  background: #eff6ff;
}
.luogo-chip-toggle.luogo-chip-active {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}
.luogo-chip-toggle input[type=checkbox] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.luogo-chip-toggle .chip-toggle-icon { font-size: 9px; opacity: 0.7; }

/* ── MANSIONI – grid 3 colonne ── */
.mansioni-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}
.mansioni-col-header {
  background: #1e3a5f;
  color: white;
  padding: 8px 12px;
  display: grid;
  grid-template-columns: 28px 1fr 60px;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.mansioni-col-header:first-child,
.mansioni-col-header:nth-child(2) {
  border-right: 1px solid #2d5a8e;
}
.mansioni-cat-header {
  grid-column: 1 / -1;
  background: #f1f5f9;
  padding: 5px 12px;
  font-size: 10px;
  font-weight: 700;
  color: #1e3a5f;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}
.mansioni-cat-header:hover { background: #e2e8f0; }
.mansione-row {
  display: grid;
  grid-template-columns: 28px 1fr 60px;
  gap: 8px;
  align-items: center;
  padding: 5px 12px;
  border-bottom: 1px solid #f1f5f9;
  min-height: 34px;
  transition: background 0.1s;
  background: white;
}
.mansione-row:hover { background: #f8fafc; }
.mansione-row.selected {
  background: #eff6ff !important;
  border-left: 3px solid #1e3a5f;
}
.mansione-row.col-left { border-right: 1px solid #e8edf2; }
.mansione-row input[type=checkbox] {
  width: 15px;
  height: 15px;
  accent-color: #1e3a5f;
  cursor: pointer;
  justify-self: center;
}
.mansione-row .nome {
  font-size: 12px;
  color: #374151;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mansione-row.selected .nome {
  font-weight: 500;
  color: #1e3a5f;
}
.mansione-row input[type=number] {
  width: 100%;
  padding: 3px 4px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 11px;
  text-align: center;
  background: white;
}
.mansione-row input[type=number]:focus {
  border-color: #1e3a5f;
  outline: none;
  background: #eff6ff;
}
.mansione-row input[type=number]:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── LAVORATORI NOMINALI – layout compatto ── */
.mansione-lav-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.mansione-lav-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}
.mansione-lav-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  flex: 1;
  min-width: 0;
}
.lav-mini-table { width: 100%; border-collapse: collapse; }
.lav-mini-table td {
  padding: 4px 12px;
  border-bottom: 1px solid #f8fafc;
  vertical-align: middle;
}
.lav-mini-table tr:last-child td { border-bottom: none; }
.lav-mini-table tr:hover td { background: #fafafa; }
.lav-mini-table tr:hover td.lav-attr-row { background: #fafbfc; }
.attrezzature-scroll-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 6px 12px;
  border-top: 1px solid #f1f5f9;
}
.attrezzature-scroll-label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
  flex-shrink: 0;
}
.attrezzature-scroll-chips {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 2px;
  flex: 1;
  scrollbar-width: thin;
}
.attr-chip-mini {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 8px;
  font-size: 10px;
  white-space: nowrap;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}
/* Attrezzature interattive per lavoratore */
.attr-chip-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
  color: #94a3b8;
  user-select: none;
  white-space: nowrap;
}
.attr-chip-check.checked {
  background: #eff6ff;
  border-color: #1e3a5f;
  color: #1e3a5f;
  font-weight: 500;
}
.attr-chip-check.manuale {
  border-style: dashed;
  background: #f0fdf4;
  border-color: #16a34a;
  color: #166534;
}
.attr-chip-check.manuale.checked {
  background: #dcfce7;
  border-color: #16a34a;
  color: #166534;
}
.attr-chip-check .remove-attr {
  margin-left: 2px;
  opacity: 0.4;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
}
.attr-chip-check .remove-attr:hover { opacity: 1; color: #dc2626; }
.lav-attr-row {
  padding: 6px 12px 10px 28px;
  border-bottom: 2px solid #f1f5f9;
  background: #fafbfc;
}
.lav-attr-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.lav-attr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.lav-attr-add {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}
.lav-attr-add input {
  flex: 1;
  padding: 4px 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 11px;
  background: #f8fafc;
  outline: none;
  max-width: 240px;
}
.lav-attr-add input:focus { border-color: #1e3a5f; background: white; }
.lav-attr-add button {
  background: #1e3a5f;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
}
.lav-inline-name {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: text;
  width: 150px;
}
.lav-inline-name:focus {
  background: #f1f5f9;
  border-radius: 4px;
  padding: 0 4px;
}

/* Accordion mansione style */
.accordion-mansione {
  border: 1px solid #c8d6e5;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  background: #eef2f7;
  border: none;
  padding: 0 14px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #1e3a5f;
  text-align: left;
  border-radius: 0;
  gap: 12px;
  transition: background 0.15s;
}

.accordion-header:hover {
  background: #dde6f0;
}

.accordion-header.open {
  background: #1e3a5f;
  color: #ffffff;
}

.accordion-header-title {
  flex: 1;
  font-size: 14px;
}

.accordion-header-stats {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.accordion-stat {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255,255,255,0.25);
  color: inherit;
}

.accordion-stat-elevato {
  background: #fca5a5;
  color: #991b1b;
}

.accordion-header.open .accordion-stat-elevato {
  background: rgba(252, 165, 165, 0.3);
  color: #fecaca;
}

.accordion-arrow {
  font-size: 11px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.accordion-header.open .accordion-arrow {
  transform: rotate(90deg);
}

.accordion-body {
  background: #fff;
  border-top: 1px solid #c8d6e5;
}

/* Legacy - kept for DVR document only */
.mansione-rischi-card {
  background: #f8fafc;
  border: 1px solid #c8d6e5;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}

.mansione-rischi-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a3a5c;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid #2c5f8a;
}

.luogo-rischi-section {
  margin-bottom: 0;
  padding: 6px 12px 0 12px;
  border-left: none;
}

.luogo-rischi-section:last-child {
  padding-bottom: 6px;
}

.luogo-rischi-title {
  font-size: 12px;
  font-weight: 600;
  color: #2c5f8a;
  margin-bottom: 4px;
  padding: 4px 0;
  background: none;
  border-radius: 0;
  border-bottom: 1px solid #e4eaf0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.luogo-manual-badge {
  font-size: 12px;
  font-weight: normal;
  color: #64748b;
  font-style: italic;
}

.rischi-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-left: 0;
}

/* 2 columns on tablet */
@media (min-width: 600px) {
  .rischi-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Livelli di rischio – compact style: white bg, colored left border only */
.rischio-livello-basso {
  background: #ffffff;
  border: none;
  border-left: 3px solid #22c55e;
  padding: 5px 10px;
  border-radius: 0;
}

.rischio-livello-accettabile {
  background: #ffffff;
  border: none;
  border-left: 3px solid #eab308;
  padding: 5px 10px;
  border-radius: 0;
}

.rischio-livello-notevole {
  background: #ffffff;
  border: none;
  border-left: 3px solid #f97316;
  padding: 5px 10px;
  border-radius: 0;
}

.rischio-livello-elevato {
  background: #ffffff;
  border: none;
  border-left: 3px solid #ef4444;
  padding: 5px 10px;
  border-radius: 0;
}

/* Legacy aliases */
.rischio-livello-molto-basso { background: #ffffff; border: none; border-left: 3px solid #22c55e; padding: 5px 10px; border-radius: 0; }
.rischio-livello-medio { background: #ffffff; border: none; border-left: 3px solid #f97316; padding: 5px 10px; border-radius: 0; }
.rischio-livello-alto { background: #ffffff; border: none; border-left: 3px solid #ef4444; padding: 5px 10px; border-radius: 0; }

.rischio-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  margin-left: 8px;
  letter-spacing: 0.5px;
}

.rischio-badge-basso {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.rischio-badge-accettabile {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.rischio-badge-notevole {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.rischio-badge-elevato {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Legacy aliases */
.rischio-badge-molto-basso { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.rischio-badge-medio { background: #fed7aa; color: #9a3412; border: 1px solid #f97316; }
.rischio-badge-alto { background: #fca5a5; color: #991b1b; border: 1px solid #ef4444; }

/* Preview allegato styles */
.preview-allegato {
  margin-top: 24px;
  border: 1px solid #dbe3ea;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.preview-allegato:empty {
  display: none;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #dbe3ea;
}

.preview-header h3 {
  margin: 0;
  font-size: 18px;
  color: #111827;
  font-weight: 600;
}

.btn-close-preview {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-close-preview:hover {
  background: #dc2626;
}

.preview-iframe {
  width: 100%;
  height: 700px;
  border: none;
  display: block;
}

.preview-image-container {
  padding: 20px;
  text-align: center;
  background: #f8fafc;
}

.preview-image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

@media (max-width: 700px) {
  .preview-iframe {
    height: 500px;
  }

  .preview-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .preview-header h3 {
    font-size: 16px;
  }

  .btn-close-preview {
    width: 100%;
  }
}

.dvr-output {
  background: #f8fafc;
}

.dvr-document {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dvr-section {
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: #ffffff;
}

.dvr-section h3 {
  margin: 0 0 8px 0;
  color: #0f172a;
  font-size: 14px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
}

.dvr-section h4 {
  margin: 10px 0 8px 0;
  color: #1e3a8a;
  font-size: 15px;
}

.dvr-section h5 {
  margin: 8px 0 6px 0;
  color: #0c4a6e;
  font-size: 14px;
}

.dvr-section p {
  margin: 6px 0;
  line-height: 1.5;
}

.dvr-section ul {
  margin: 8px 0 0 18px;
  padding: 0;
}

.dvr-section li {
  margin-bottom: 5px;
  line-height: 1.45;
}

.dvr-mansione-card {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

.dvr-luogo-card {
  border-left: 3px solid #93c5fd;
  background: #ffffff;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
}

.dvr-risk-block {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  background: #f8fafc;
}

.dvr-template-note {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  border: 1px dashed #94a3b8;
  background: #f8fafc;
}

/* 2-column grid for DVR dati progetto / figure prevenzione */
.dvr-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-bottom: 10px;
}

.dvr-data-cell {
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 10px;
}

.dvr-data-label {
  font-size: 0.75em;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.dvr-data-value {
  font-size: 0.95em;
  color: #0f172a;
  font-weight: 500;
}

@media (max-width: 600px) {
  .dvr-data-grid {
    grid-template-columns: 1fr;
  }
}

/* Table documenti allegati nel DVR */
.dvr-allegati-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.dvr-allegati-table thead {
  background: #f1f5f9;
}

.dvr-allegati-table th {
  padding: 10px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.dvr-allegati-table td {
  padding: 10px;
  border: 1px solid #e2e8f0;
  color: #334155;
}

.dvr-allegati-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.dvr-allegati-table tbody tr:hover {
  background: #f1f5f9;
}

/* Matrice di Rischio */
.matrice-rischio-container {
  margin-top: 16px;
}

.matrice-rischio-container h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #111827;
}

.matrice-descrizione {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #64748b;
}

.matrice-rischio {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.matrice-rischio th,
.matrice-rischio td {
  border: 1px solid #cbd5e1;
  padding: 12px 8px;
  text-align: center;
  font-size: 13px;
}

.matrice-rischio th {
  background: #f1f5f9;
  font-weight: 600;
  color: #475569;
}

.matrice-corner {
  background: #e2e8f0 !important;
  font-weight: bold;
}

.matrice-label {
  background: #f8fafc;
  font-weight: 600;
  text-align: left;
  padding-left: 12px;
}

.matrice-cell {
  position: relative;
  font-weight: bold;
  transition: transform 0.2s ease;
}

.matrice-cell:hover {
  transform: scale(1.05);
}

.matrice-indice {
  font-size: 16px;
  font-weight: bold;
}

.matrice-cell-molto-basso {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.matrice-cell-basso {
  background: #fef08a;
  color: #854d0e;
  border-color: #eab308;
}

.matrice-cell-medio {
  background: #fdba74;
  color: #9a3412;
  border-color: #f97316;
}

.matrice-cell-alto {
  background: #fca5a5;
  color: #991b1b;
  border-color: #ef4444;
}

.matrice-legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
}

/* Styles pour export PDF - wrapper temporaneo */
.pdf-export-wrapper {
  background: white;
  padding: 16px;
  margin: 0;
  width: 210mm;
  min-height: auto;
}

.pdf-export-wrapper * {
  page-break-inside: avoid;
}

.pdf-export-wrapper .dvr-section {
  page-break-inside: avoid;
  margin-bottom: 16px;
}

.pdf-export-wrapper h3 {
  page-break-after: avoid;
  margin-top: 8px;
}

.pdf-export-wrapper table {
  page-break-inside: auto;
}

.pdf-export-wrapper tr {
  page-break-inside: avoid;
  page-break-after: auto;
}

.page-break {
  page-break-before: always;
}

.legenda-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.legenda-color {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

/* Info rischio con P, G, IR */
.risk-matrix-info {
  margin: 4px 0 8px 0;
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
}

/* Localizzazione box */
.localizzazione-box {
  background: #f8fafc;
  border-left: 4px solid #3b82f6;
  padding: 14px;
  margin-bottom: 20px;
  border-radius: 6px;
}

.localizzazione-box a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.localizzazione-box a:hover {
  text-decoration: underline;
}

/* Link Google Maps */
.link-maps {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.link-maps:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

@media (max-width: 700px) {
  .matrice-rischio th,
  .matrice-rischio td {
    padding: 8px 4px;
    font-size: 11px;
  }

  .matrice-indice {
    font-size: 14px;
  }

  .matrice-legenda {
    flex-direction: column;
    gap: 8px;
  }
}

/* ==============================
   DVR ITEMS GRID (mansioni/luoghi 3-col)
============================== */
.dvr-items-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  margin: 6px 0;
}

.dvr-item-chip {
  display: inline-block;
  background: #f0f4f8;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  color: #1e293b;
  line-height: 1.4;
}

.dvr-3col .dvr-item-chip {
  min-width: 150px;
  flex: 1 1 calc(33% - 8px);
  max-width: calc(33% - 8px);
}

@media (max-width: 700px) {
  .dvr-3col .dvr-item-chip {
    flex: 1 1 calc(50% - 8px);
    max-width: calc(50% - 8px);
  }
}

@media (max-width: 480px) {
  .dvr-3col .dvr-item-chip {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

/* ==============================
   DVR COMPACT RISK GRID (P3)
============================== */
.dvr-rischi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
  margin: 4px 0;
}

.dvr-rischio-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 2px 4px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.dvr-rischio-nome {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  flex: 1 1 120px;
}

.dvr-rischio-meta {
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .dvr-rischi-grid { grid-template-columns: 1fr; }
}

/* ==============================
   TABLET OPTIMIZATION
   min touch target 48px, 16px+ font
============================== */
@media (max-width: 1024px) {
  body {
    font-size: 16px;
  }

  .page {
    padding: 0 12px 32px 12px;
    margin: 16px auto;
  }

  .card {
    padding: 18px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
    min-height: 44px;
    padding: 10px 12px;
  }

  .form-group label {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
  }

  button,
  .btn-secondary,
  .btn-export,
  .project-tab {
    min-height: 48px;
    font-size: 15px;
    padding: 10px 16px;
  }

  .nav-btn {
    padding: 12px 14px;
    font-size: 13px;
    min-height: 48px;
  }

  /* Checkboxes grandi per tablet con touch target 48px */
  input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    cursor: pointer;
    accent-color: #1976d2;
  }

  .checkbox-item {
    min-height: 48px;
    padding: 4px 8px;
  }

  .checkbox-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
  }

  .luogo-tile,
  .mansione-tile {
    min-height: 48px;
    font-size: 15px;
    padding: 10px 14px;
  }

  .header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-content {
    padding: 16px;
    max-height: 90vh;
  }
}

/* ==============================
   DPI DOCUMENT STYLES
============================== */
.dpi-documento {
  font-size: 14px;
}

.dpi-documento h3 {
  color: #1a237e;
  border-bottom: 2px solid #1976d2;
  padding-bottom: 8px;
  margin-bottom: 20px;
}

.dpi-mansione-block {
  margin-bottom: 28px;
}

.dpi-mansione-block h4 {
  background: #e3f2fd;
  color: #0d47a1;
  padding: 8px 14px;
  border-radius: 6px;
  margin: 0 0 12px 0;
  font-size: 15px;
}

.dpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dpi-table th {
  background: #1976d2;
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
}

.dpi-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: top;
}

.dpi-table tr:nth-child(even) td {
  background: #f5f9ff;
}

.dpi-table tr:hover td {
  background: #e3f2fd;
}

/* ==============================
   COMPACT CHECKBOX RISK ROWS
============================== */
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-height: 34px;
  padding-right: 8px;
  transition: background 0.1s;
  font-size: 13px;
}

.checkbox-item:hover {
  background: #f0f4f8 !important;
}

.checkbox-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  accent-color: #1a3a5c;
  cursor: pointer;
}

.checkbox-item span {
  flex: 1;
  line-height: 1.3;
}

.checkbox-item small {
  font-size: 11px;
  color: #8898aa;
  flex-shrink: 0;
}

.mini-remove-btn {
  background: #ef4444 !important;
  color: white !important;
  border-radius: 50% !important;
  width: 18px !important;
  height: 18px !important;
  padding: 0 !important;
  font-size: 10px !important;
  line-height: 18px !important;
  flex-shrink: 0;
  min-height: unset !important;
}

/* Compat luogo labels */
.compat-luogo-label {
  border: 1px solid #c8d6e5;
  border-radius: 6px;
  padding: 6px 10px;
  background: #fff;
  font-size: 13px;
}

.compat-luogo-label:hover {
  background: #eef2f7 !important;
  border-color: #1a3a5c;
}

/* ==============================
   APP HEADER (compact 50px)
============================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 18px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 1px 6px rgba(0,0,0,0.25);
}

.app-header-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.app-header-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.app-header-brand {
  font-size: 15px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  flex-shrink: 0;
}

.app-header-project {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.app-header-settore {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  border-radius: 10px;
  padding: 2px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-header-stat {
  font-size: 12px;
  font-weight: 700;
  color: #4ade80;
  white-space: nowrap;
}

.app-header-bar {
  width: 80px;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  overflow: hidden;
}

@media (max-width: 600px) {
  .app-header-brand {
    display: none;
  }
  .app-header-bar {
    width: 50px;
  }
}

/* ==============================
   DPI TAB — 3 COLONNE ALLEGATO VIII
============================== */
.dpi-documento { font-family: inherit; }

.dpi-categorie-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 10px;
  background: #f8fafc;
}

.dpi-categoria-card {
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
  background: #fff;
}

.dpi-cat-header {
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  line-height: 1.2;
}

.dpi-lista { padding: 2px 0; background: #fff; }

.dpi-riga {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  font-size: 11px;
  color: #374151;
  border-bottom: 1px solid #f1f5f9;
  min-height: 26px;
}

.dpi-riga:last-child { border-bottom: none; }

.dpi-riga .dpi-icon {
  font-size: 12px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.dpi-riga .dpi-nome {
  flex: 1;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dpi-riga .dpi-norma {
  font-size: 9px;
  color: #0369a1;
  background: #e0f2fe;
  padding: 1px 5px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dpi-cat-badge {
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.cat-I   { background: #dcfce7; color: #166534; }
.cat-II  { background: #fef9c3; color: #854d0e; }
.cat-III { background: #fecaca; color: #991b1b; }

.dpi-empty {
  padding: 6px 8px;
  font-size: 10px;
  color: #94a3b8;
  font-style: italic;
}

/* ==============================
   SORVEGLIANZA SANITARIA — Scadenzario + Lavoratori
============================== */
.sorv-mesi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: #fff;
}
.mese-card {
  padding: 8px 10px;
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  min-height: 60px;
}
.mese-card:nth-child(4n) { border-right: none; }
.mese-card.mese-corrente { background: #f0f9ff; }
.mese-nome {
  font-size: 9px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.mese-visite {
  font-size: 18px;
  font-weight: 700;
  color: #1e3a5f;
}
.mese-no-visite .mese-visite { color: #cbd5e1; font-size: 14px; }
.mese-dot-urgente { color: #dc2626; }
.mese-dot-prossimo { color: #f59e0b; }
.mese-dot-ok { color: #16a34a; }

.stato-scaduta  { display:inline-block; padding:2px 7px; border-radius:10px; font-size:10px; font-weight:600; background:#fecaca; color:#991b1b; }
.stato-scadenza { display:inline-block; padding:2px 7px; border-radius:10px; font-size:10px; font-weight:600; background:#fef9c3; color:#854d0e; }
.stato-ok       { display:inline-block; padding:2px 7px; border-radius:10px; font-size:10px; font-weight:600; background:#dcfce7; color:#166534; }
.stato-da-prog  { display:inline-block; padding:2px 7px; border-radius:10px; font-size:10px; font-weight:600; background:#f1f5f9; color:#64748b; }

.sorv-lav-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sorv-lav-table th { background: #1e3a5f; color: #fff; padding: 7px 10px; font-size: 11px; font-weight: 600; text-align: left; }
.sorv-lav-table td { padding: 5px 6px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.sorv-lav-table tr:nth-child(even) td { background: #f8fafc; }

.sorv-mansione-chip {
  background: #e0f2fe;
  color: #0369a1;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  margin: 1px;
  display: inline-block;
  white-space: nowrap;
}

/* ==============================
   BADGE SIZE REDUCTION
============================== */
.rischio-badge {
  font-size: 10px !important;
  padding: 2px 6px !important;
}

/* ==============================
   DPI PROFESSIONAL LAYOUT
============================== */
.dpi-documento {
  border: 1px solid #c8d6e5;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.dpi-documento .accordion-mansione {
  border-radius: 0;
  border: none;
  border-top: 1px solid #e2e8f0;
  margin-bottom: 0 !important;
}

.dpi-documento .accordion-mansione:last-of-type {
  border-radius: 0;
}

.dpi-documento .accordion-header {
  border-radius: 0;
  height: 40px;
  font-size: 13px;
}

.dpi-documento table tr:last-child td {
  border-bottom: none;
}

/* Compact form-grid for tablet: 3 cols on wide screens */
@media (min-width: 900px) {
  .form-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* Project tab bar – compact pill style */
.project-tabs {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: 14px 0 8px 0;
  flex-wrap: wrap;
}

.project-tabs .project-tab {
  padding: 6px 16px;
  font-size: 12.5px;
  border-radius: 6px;
  font-weight: 600;
  height: auto;
  line-height: 1.4;
}

/* Tab panel compact */
.dvr-tab-panel .card:first-child {
  margin-top: 0;
}

/* ==============================
   RISCHI TAB — 3-COLONNE COMPATTE
============================== */
#rischiContainer .accordion-header {
  height: 36px;
  min-height: 36px;
  font-size: 12px;
  padding: 0 10px;
}

#rischiContainer .accordion-header-title {
  font-size: 12px;
  font-weight: 600;
}

.rischi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
  border-radius: 0 0 4px 4px;
  overflow: hidden;
}

.rischio-subheader {
  grid-column: 1 / -1;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-top: 1px solid #e2e8f0;
}

.rischio-subheader:first-child {
  border-top: none;
}

.rischio-item {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  padding: 4px 8px;
  min-height: 30px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

.rischio-item:hover {
  background: #f8fafc;
}

.rischio-item input[type="checkbox"] {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #3b82f6;
}

.rischio-item:has(input:checked) {
  background: #eff6ff;
}

.rischio-icon {
  font-size: 13px;
  flex-shrink: 0;
  line-height: 1;
}

.rischio-nome {
  flex: 1;
  font-size: 11px;
  color: #1e293b;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.rischio-badge-xs {
  flex-shrink: 0;
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.rischio-badge-xs.basso   { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.rischio-badge-xs.accettabile { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.rischio-badge-xs.notevole { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }
.rischio-badge-xs.elevato  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.rischio-item.lv-notevole { border-left: 2px solid #f97316; }
.rischio-item.lv-elevato  { border-left: 2px solid #ef4444; }

/* Manual remove btn inside rischio-item */
.rischio-item .mini-remove-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 10px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.rischio-item .mini-remove-btn:hover { color: #ef4444; }

/* Compat-luogo label compatta */
.compat-luogo-label {
  min-height: 32px !important;
  padding: 4px 10px !important;
}

/* ==============================
   PILLS / CHIPS (Mansioni & Luoghi)
============================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pill.pill-green {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.pill.pill-orange {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fed7aa;
}

.pill.pill-red {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 6px 0;
}

/* ==============================
   RISCHIO COMPACT ROW LAYOUT
============================== */
.rischio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  margin-bottom: 5px;
}

.rischio-row:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.rischio-row .rischio-nome {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rischio-row .rischio-pmr {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.rischio-row .pmr-input {
  width: 50px;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  text-align: center;
}

.rischio-row .pmr-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
}

.rischio-row .rischio-level-badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  min-width: 80px;
  text-align: center;
}

/* ==============================
   MAPPING CARDS (Mansione ↔ Luoghi)
============================== */
.mapping-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: box-shadow 0.15s;
}

.mapping-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.mapping-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.mapping-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e3a5f;
  flex: 1;
}

.mapping-card-count {
  font-size: 11px;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 4px;
  padding: 2px 7px;
  font-weight: 600;
}

.mapping-card-luoghi {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* ============================================================
   LAYOUT COMPATTO DVR — Problema 2
   Riduce spazio bianco eccessivo nel documento generato
   ============================================================ */

/* Documento DVR: gap ridotto tra sezioni */
.dvr-document {
  gap: 8px;
}

/* Sezioni compatte */
.dvr-section {
  margin-bottom: 6px;
  padding: 7px 12px;
}

.dvr-section h3 {
  font-size: 13px;
  margin-bottom: 4px;
  padding: 3px 8px;
  background: #1e3a5f;
  color: white;
  border-radius: 4px;
  border-bottom: none;
}

.dvr-section h4 {
  margin: 6px 0 4px 0;
  font-size: 13px;
}

.dvr-section h5 {
  margin: 4px 0 3px 0;
  font-size: 12px;
}

.dvr-section p {
  margin: 3px 0;
  line-height: 1.4;
  font-size: 12px;
}

.dvr-section ul {
  margin: 4px 0 0 16px;
}

.dvr-section li {
  margin-bottom: 3px;
  line-height: 1.3;
  font-size: 12px;
}

/* Mansioni e luoghi: 3 colonne compatte */
.dvr-lista-mansioni,
.dvr-lista-luoghi {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px 8px;
  padding: 6px;
}

.dvr-lista-mansioni li,
.dvr-lista-luoghi li {
  font-size: 12px;
  padding: 2px 0;
  line-height: 1.3;
}

/* Item chips mansioni/luoghi */
.dvr-items-grid {
  gap: 3px;
}

.dvr-item-chip {
  font-size: 11px !important;
  padding: 2px 8px !important;
}

/* Card mansione/luogo compatte */
.dvr-mansione-card {
  padding: 7px;
  margin-bottom: 6px;
}

.dvr-luogo-card {
  padding: 5px 8px;
  margin-top: 4px;
}

/* Rischi: 2 colonne compatte */
.dvr-rischi-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 2px 8px;
}

.dvr-rischio-item {
  font-size: 12px;
  padding: 3px 6px;
  border-left: 3px solid #ccc;
  line-height: 1.3;
}

.dvr-rischio-item.elevato    { border-color: #dc2626; }
.dvr-rischio-item.notevole   { border-color: #ea580c; }
.dvr-rischio-item.accettabile{ border-color: #ca8a04; }
.dvr-rischio-item.basso      { border-color: #16a34a; }

/* Blocchi rischio compatti */
.dvr-risk-block {
  padding: 7px;
  margin-bottom: 6px;
}

.dvr-risk-block h4 {
  margin: 0 0 3px 0;
  font-size: 12px;
}

.dvr-risk-block ul {
  margin: 3px 0 0 16px;
}

.dvr-risk-block li {
  font-size: 11px;
  margin-bottom: 2px;
  line-height: 1.3;
}

/* Griglia dati 2 colonne — padding ridotto */
.dvr-data-grid {
  gap: 4px 8px;
  margin-bottom: 6px;
}

.dvr-data-cell {
  padding: 4px 8px;
}

.dvr-data-label {
  font-size: 0.7em;
  margin-bottom: 1px;
}

.dvr-data-value {
  font-size: 0.88em;
}

/* Griglia generica 2 col */
.dvr-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.dvr-field {
  font-size: 12px;
  padding: 2px 0;
}

.dvr-field strong {
  color: #1e3a5f;
  font-size: 11px;
  display: block;
}

/* Matrice rischio: celle più compatte */
.matrice-rischio th,
.matrice-rischio td {
  padding: 7px 5px;
  font-size: 12px;
}

/* Template note compatta */
.dvr-template-note {
  margin-top: 6px;
  padding: 7px;
  font-size: 11px;
}

@media (max-width: 700px) {
  .dvr-rischi-grid        { grid-template-columns: 1fr; }
  .dvr-lista-mansioni,
  .dvr-lista-luoghi       { grid-template-columns: repeat(2, 1fr); }
  .dvr-grid-2col          { grid-template-columns: 1fr; }
}

/* ============================================================
   FIX LARGHEZZA DVR GENERATO (#dvrOutput)
   ============================================================ */
#dvrOutput {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

#dvrOutput .dvr-document {
  width: 100% !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

#dvrOutput .dvr-section {
  width: 100% !important;
  box-sizing: border-box !important;
  align-self: stretch;
}

#dvrOutput .dvr-data-grid {
  width: 100% !important;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}

#dvrOutput .dvr-mansione-card,
#dvrOutput .dvr-risk-block,
#dvrOutput .dvr-luogo-card {
  width: 100% !important;
  box-sizing: border-box !important;
}

#dvrOutput .dvr-rischi-grid {
  width: 100% !important;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
}

#dvrOutput .dvr-items-grid {
  width: 100% !important;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#dvrOutput table {
  width: 100% !important;
  box-sizing: border-box !important;
}

@media (max-width: 700px) {
  #dvrOutput .dvr-data-grid,
  #dvrOutput .dvr-rischi-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== STAMPA DIRETTA DA BROWSER ===== */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; box-sizing: border-box !important; }
  @page { size: A4 portrait; margin: 10mm 10mm 10mm 10mm; }

  /* Nascondi tutto tranne il contenuto DVR */
  body > *:not(#app):not(#root):not(main):not(.dvr-layout):not(.main-content) { display: none !important; }
  nav, .sidebar, aside, .nav-tabs, .tab-navigation, [class*="sidebar"], [class*="navbar"],
  button, .btn, [class*="btn"], [class*="button"], .no-print, .salva-section, .progress-bar,
  input, select, textarea, .form-control, label, .esportazione-controls,
  header {
    display: flex !important;
    background: #1e3a5f !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    padding: 6px 12px !important;
    margin-bottom: 8px !important;
  }
  header * { font-size: 7pt !important; }
  #header-project-name { font-size: 11pt !important; font-weight: 500 !important; }

  body { font-size: 9pt !important; color: #000 !important; background: white !important; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important; }

  #dvrOutput { display: block !important; width: 100% !important; max-width: 100% !important; padding: 0 !important; margin: 0 !important; }

  h1 { font-size: 14pt !important; margin: 6pt 0 2pt !important; }
  h3 { font-size: 9pt !important; padding: 2px 8px !important; margin: 5pt 0 2pt !important; page-break-after: avoid !important; }
  h4 { font-size: 8.5pt !important; margin: 3pt 0 1pt !important; page-break-after: avoid !important; }
  p { margin: 1pt 0 !important; font-size: 8.5pt !important; }
  div { margin-bottom: 0 !important; }

  .dvr-section { padding: 4px 8px !important; margin-bottom: 4pt !important; }
  .dvr-data-grid { grid-template-columns: 1fr 1fr !important; gap: 2px 8px !important; }
  .dvr-data-cell { padding: 2px 6px !important; }
  .dvr-data-label { font-size: 7pt !important; }
  .dvr-data-value { font-size: 8.5pt !important; }
  .dvr-item-chip { font-size: 7.5pt !important; padding: 1px 4px !important; }
  .dvr-rischio-row { font-size: 8pt !important; min-height: 16px !important; padding: 1px 3px !important; }
  .dvr-mansione-card { padding: 4px 6px !important; margin-bottom: 3pt !important; break-inside: avoid !important; }
  .dvr-luogo-card { padding: 3px 6px !important; margin-top: 2pt !important; }
  .dvr-risk-block { padding: 4px 6px !important; margin-bottom: 3pt !important; break-inside: avoid !important; }
  .dvr-risk-block li { font-size: 8pt !important; margin-bottom: 1px !important; }

  table { font-size: 8pt !important; border-collapse: collapse !important; }
  thead { display: table-header-group !important; }
  tr { break-inside: avoid !important; }
  th { padding: 2px 5px !important; }
  td { padding: 2px 5px !important; }

  .badge-elevato, .badge-notevole, .badge-accettabile, .badge-basso { font-size: 7pt !important; padding: 0 4px !important; }
}

/* ─── TABELLA MANSIONI EXCEL-STYLE ─── */
.dvr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}
.dvr-table thead tr {
  background: #1e3a5f;
  color: white;
}
.dvr-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-right: 1px solid #2d5a8e;
}
.dvr-table thead th:last-child { border-right: none; }
.dvr-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
.dvr-table tbody tr:hover:not(.categoria-header) { background: #f8fafc; }
.dvr-table tbody tr.selected {
  background: #eff6ff !important;
  border-left: 3px solid #1e3a5f;
}
.dvr-table tbody td {
  padding: 6px 12px;
  color: #374151;
  border-right: 1px solid #f1f5f9;
}
.dvr-table tbody td:last-child { border-right: none; }
.dvr-table tr.categoria-header {
  background: #f1f5f9;
  cursor: pointer;
  user-select: none;
}
.dvr-table tr.categoria-header:hover { background: #e2e8f0; }
.dvr-table tr.categoria-header td {
  font-size: 11px;
  font-weight: 700;
  color: #1e3a5f;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 7px 12px;
  border-right: none;
}
.dvr-table input[type=number].lav-spinner {
  width: 70px;
  padding: 4px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
  background: white;
}
.dvr-table input[type=number].lav-spinner:focus {
  outline: none;
  border-color: #1e3a5f;
  background: #eff6ff;
}
.dvr-table input[type=number].lav-spinner:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.dvr-table input[type=checkbox] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #1e3a5f;
}
.search-mansioni {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  background: white;
  box-sizing: border-box;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 16px;
}
.search-mansioni:focus { outline: none; border-color: #1e3a5f; }
.luogo-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  margin: 2px;
  border: 1px solid #bae6fd;
  white-space: nowrap;
}
.luogo-chip .chip-remove,
.luogo-chip .remove {
  cursor: pointer;
  font-size: 10px;
  opacity: 0.6;
  margin-left: 2px;
}
.luogo-chip .chip-remove:hover,
.luogo-chip .remove:hover { opacity: 1; color: #dc2626; }
.mansioni-manuali-inline {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 8px;
}
.mansioni-manuali-inline-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.mansioni-manuali-inline-input-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 13px;
}
.mansioni-manuali-inline-input-row button {
  background: #1e3a5f;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

/* ── Attrezzature per mansione (espandibili) ── */
.mansione-attr-toggle-row {
  padding: 3px 12px 4px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.mansione-attr-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: #475569;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.1s, color 0.1s;
}
.mansione-attr-toggle-btn:hover {
  background: #e2e8f0;
  color: #1e3a5f;
}
.mansione-attr-toggle-btn.active {
  color: #1e3a5f;
}
.attr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 8px 12px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.attr-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  border: 1px solid transparent;
  font-size: 11px;
  color: #374151;
  user-select: none;
}
.attr-check-item:hover {
  background: #e0f2fe;
}
.attr-check-item input[type=checkbox] {
  width: 14px;
  height: 14px;
  accent-color: #1e3a5f;
  flex-shrink: 0;
  pointer-events: none;
}
.attr-check-item.checked {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a5f;
}
.attr-check-item.manuale {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-style: dashed;
  color: #166534;
}
.attr-icon {
  font-size: 13px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.attr-nome {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.attr-add-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border-top: 1px dashed #e2e8f0;
  margin-top: 4px;
}
.attr-add-input {
  flex: 1;
  padding: 5px 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 20px;
  font-size: 11px;
  background: white;
  outline: none;
  color: #374151;
  max-width: 300px;
}
.attr-add-input:focus {
  border-color: #1e3a5f;
  background: #eff6ff;
}
.attr-add-btn {
  background: #1e3a5f;
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}

