    :root {
      --sidebar-width: 240px;
      --sidebar-bg: #1a2035;
      --sidebar-hover: #2d3a5a;
      --sidebar-active: #3d5291;
      --accent: #4a7fd4;
      --top-bar-h: 56px;
    }

    body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: #f0f2f5; }

    /* ── Sidebar ─────────────────────────────────────── */
    #sidebar {
      position: fixed; top: 0; left: 0; bottom: 0;
      width: var(--sidebar-width); background: var(--sidebar-bg);
      display: flex; flex-direction: column; z-index: 1000;
      transition: transform .3s;
    }
    #sidebar .brand {
      padding: 18px 20px 14px; color: #fff;
      font-weight: 700; font-size: 1.1rem; letter-spacing: .5px;
      border-bottom: 1px solid rgba(255,255,255,.08);
    }
    #sidebar .brand small { display: block; font-size: .7rem; font-weight: 400; opacity: .5; margin-top: 2px; }
    #sidebar nav a {
      display: flex; align-items: center; gap: 12px;
      padding: 11px 20px; color: rgba(255,255,255,.7);
      text-decoration: none; font-size: .88rem;
      transition: background .15s, color .15s;
    }
    #sidebar nav a:hover { background: var(--sidebar-hover); color: #fff; }
    #sidebar nav a.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
    #sidebar nav .nav-section {
      padding: 16px 20px 6px; font-size: .68rem; font-weight: 700;
      letter-spacing: 1px; color: rgba(255,255,255,.3); text-transform: uppercase;
    }
    #sidebar .sidebar-footer {
      margin-top: auto; padding: 14px 20px;
      border-top: 1px solid rgba(255,255,255,.08);
    }
    #sidebar .sidebar-footer .user-info { color: rgba(255,255,255,.7); font-size: .8rem; }
    #sidebar .sidebar-footer .user-name { color: #fff; font-weight: 600; font-size: .88rem; }

    /* ── Main area ──────────────────────────────────── */
    #app {
      margin-left: var(--sidebar-width);
      min-height: 100vh; display: flex; flex-direction: column;
    }
    #topbar {
      height: var(--top-bar-h); background: #fff;
      box-shadow: 0 1px 4px rgba(0,0,0,.08);
      display: flex; align-items: center; padding: 0 24px;
      gap: 16px; position: sticky; top: 0; z-index: 900;
    }
    #topbar h5 { margin: 0; font-size: 1rem; font-weight: 600; color: #1a2035; flex: 1; }
    #main-content { padding: 24px; flex: 1; }

    /* ── Login overlay ──────────────────────────────── */
    #login-overlay {
      position: fixed; inset: 0; z-index: 9999;
      background: linear-gradient(135deg, #1a2035 0%, #2d3a5a 100%);
      display: flex; align-items: center; justify-content: center;
    }
    .login-card {
      background: #fff; border-radius: 16px; padding: 40px;
      width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
    }
    .login-card .logo { text-align: center; margin-bottom: 28px; }
    .login-card .logo h2 { font-weight: 800; color: var(--sidebar-bg); margin: 8px 0 4px; }
    .login-card .logo p { color: #6c757d; font-size: .85rem; margin: 0; }
    .btn-ms {
      background: #fff; border: 2px solid #ddd; color: #333;
      display: flex; align-items: center; justify-content: center; gap: 10px;
      width: 100%; padding: 10px; border-radius: 8px; font-size: .9rem;
      transition: border-color .2s, background .2s;
    }
    .btn-ms:hover { border-color: #0078d4; background: #f0f7ff; }

    /* ── Cards / KPI ────────────────────────────────── */
    .kpi-card {
      background: #fff; border-radius: 12px; padding: 20px 24px;
      box-shadow: 0 2px 8px rgba(0,0,0,.06); border-left: 4px solid;
    }
    .kpi-card.primary { border-color: var(--accent); }
    .kpi-card.danger  { border-color: #dc3545; }
    .kpi-card.warning { border-color: #fd7e14; }
    .kpi-card.success { border-color: #198754; }
    .kpi-card .kpi-num { font-size: 2rem; font-weight: 700; line-height: 1; }
    .kpi-card .kpi-label { color: #6c757d; font-size: .8rem; margin-top: 4px; }

    /* ── Table ──────────────────────────────────────── */
    .table-card {
      background: #fff; border-radius: 12px;
      box-shadow: 0 2px 8px rgba(0,0,0,.06); overflow: hidden;
    }
    .table-card .table-title {
      padding: 16px 20px; font-weight: 600; font-size: .95rem;
      border-bottom: 1px solid #e9ecef; display: flex; align-items: center; gap: 8px;
    }
    .table { margin: 0; }
    .table th { background: #f8f9fa; font-size: .78rem; font-weight: 600;
                text-transform: uppercase; letter-spacing: .5px; color: #6c757d;
                border-bottom: 2px solid #dee2e6; }
    .table td { font-size: .88rem; vertical-align: middle; }

    /* ── Status badges ──────────────────────────────── */
    .badge-kpi-ok      { background: #d1fae5; color: #065f46; }
    .badge-kpi-warn    { background: #fef3c7; color: #92400e; }
    .badge-kpi-danger  { background: #fee2e2; color: #991b1b; }

    /* ── Checklist ──────────────────────────────────── */
    .fase-row { transition: background .15s; border-radius: 8px; }
    .fase-row.completed { background: #f0fff4; }
    .fase-check { width: 22px; height: 22px; cursor: pointer; accent-color: #198754; }

    /* ── Progress bar ───────────────────────────────── */
    .progress { height: 8px; border-radius: 4px; }

    /* ── Spinner ────────────────────────────────────── */
    .spinner-wrap { display: flex; justify-content: center; padding: 60px 0; }
		
		/* ── Attività ────────────────────────────────────── */
		.form-check .form-check-input {
				float: left;
				margin-left: 0;
				margin-right: 0.5rem;
		}

    /* ── Matrice Ruoli Assegnati ────────────────────── */
    .matrix-wrap {
      overflow-x: auto; /* scroll orizzontale per colonne numerose */
    }
    .matrix-table {
      border-collapse: separate;
      border-spacing: 0;
      min-width: 100%;
      font-size: .82rem;
    }
    
		/* Intestazione colonne ruoli */
    .matrix-table thead th {
      background: var(--sidebar-bg); color: #fff;
      padding: 10px 12px; white-space: nowrap;
      position: sticky; top: 0; z-index: 2;
      border-right: 1px solid rgba(255,255,255,.12);
    }
    .matrix-table thead th:first-child {
      position: sticky; left: 0; z-index: 3;
      min-width: 220px; max-width: 260px;
    }
    
		/* Colonna progetto (prima) */
    .matrix-table td.col-progetto {
      position: sticky; left: 0; z-index: 1;
      background: #f8f9fa; border-right: 2px solid #dee2e6;
      padding: 10px 14px; vertical-align: top;
      min-width: 220px; max-width: 260px;
    }
    .matrix-table td.col-progetto .prj-name {
      font-weight: 600; color: #1a2035; line-height: 1.3;
    }
    .matrix-table td.col-progetto .prj-meta {
      color: #6c757d; font-size: .75rem; margin-top: 2px;
    }
    
		/* Celle ruolo */
    .matrix-table td.col-ruolo {
      padding: 8px 10px; vertical-align: top;
      border-right: 1px solid #e9ecef;
      border-bottom: 1px solid #e9ecef;
      min-width: 170px;
      background: #fff;
    }
    .matrix-table tr:hover td { background: #f5f7ff; }
    .matrix-table tr:hover td.col-progetto { background: #eef1f8; }
    
		/* Card risorsa assegnata */
    .cell-assegnata {
      background: #f0f7ff;
      border: 1px solid #c7d9f7;
      border-radius: 8px;
      padding: 7px 9px;
      display: flex; flex-direction: column; gap: 4px;
    }
    .cell-assegnata .ca-nome {
      font-weight: 600; color: #1a3a6b; font-size: .82rem;
      display: flex; align-items: center; gap: 5px;
    }
    .cell-assegnata .ca-row {
      font-size: .75rem; color: #4a5568;
      display: flex; align-items: center; gap: 5px;
    }
    .cell-assegnata .ca-row i { width: 13px; text-align: center; opacity: .65; }
    
		/* Doc incarico: ricevuto vs pendente */
    .ca-doc-ok   { color: #198754; font-weight: 600; }
    .ca-doc-pend { color: #fd7e14; }
    
		/* Cella vuota */
    .cell-vuota {
      display: flex; align-items: center; justify-content: center;
      height: 52px; color: #ced4da;
    }
    .cell-vuota i { font-size: 1.3rem; }
    
		/* Filtri toolbar */
    .matrix-toolbar {
      background: #fff; border-radius: 10px;
      padding: 14px 18px; margin-bottom: 16px;
      box-shadow: 0 2px 8px rgba(0,0,0,.06);
      display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
    }
    
		/* ── Multi-select Risorse (modale Nuova Attività) ── */
    .risorse-multiselect {
      background: #fff; max-height: 160px; overflow-y: auto;
      transition: border-color .15s, box-shadow .15s;
    }
    .risorse-multiselect:focus-within {
      border-color: #86b7fe !important;
      box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
    }
    .risorse-multiselect.is-invalid { border-color: #dc3545 !important; }
    .risorse-checkboxes .form-check {
      padding: 5px 10px; border-radius: 4px; transition: background .1s; margin: 0;
    }
    .risorse-checkboxes .form-check:hover { background: #f0f4ff; }
    .risorse-checkboxes .form-check-input:checked + .form-check-label {
      font-weight: 600; color: #0d6efd;
    }
    .badge-risorsa {
      background: #e8f0fe; color: #1a56db; border: 1px solid #c7d9f7;
      border-radius: 20px; padding: 3px 10px; font-size: .78rem;
      display: inline-flex; align-items: center; gap: 5px;
    }
    .badge-risorsa .remove-risorsa {
      cursor: pointer; opacity: .6; font-size: .75rem; line-height: 1;
    }
    .badge-risorsa .remove-risorsa:hover { opacity: 1; color: #dc3545; }

    /* ── Matrice Ruoli Assegnati ────────────────────────────── */
    .matrix-wrap {
      overflow-x: auto; overflow-y: auto;
      max-height: calc(100vh - 140px);
      border-radius: 12px;
      box-shadow: 0 2px 8px rgba(0,0,0,.07);
    }
    .matrix-table {
      border-collapse: separate; border-spacing: 0;
      min-width: 900px; background: #fff;
    }
    
		/* Intestazioni fisse */
    .matrix-table thead th {
      position: sticky; top: 0; z-index: 10;
      background: #9b9da3; color: #fff;
      font-size: .72rem; font-weight: 600; letter-spacing: .6px;
      text-transform: uppercase; padding: 10px 12px;
      border-right: 1px solid rgba(255,255,255,.1);
      white-space: nowrap;
    }
    .matrix-table thead th:first-child {
      position: sticky; left: 0; z-index: 20; min-width: 220px;
    }
    
		/* Colonna progetto fissa */
    .matrix-table tbody td:first-child {
      position: sticky; left: 0; z-index: 5;
      background: #f8f9fa; font-size: .82rem;
      padding: 10px 14px; min-width: 220px; max-width: 260px;
      border-right: 2px solid #dee2e6; border-bottom: 1px solid #e9ecef;
      vertical-align: middle;
    }
    .matrix-table tbody td:first-child .prj-commessa {
      font-size: .72rem; color: #6c757d; display: inline-block; margin-bottom: 2px;
    }
    .matrix-table tbody td:first-child .prj-nome {
      font-weight: 600; color: #1a2035; line-height: 1.3; display: block;
    }
    .matrix-table tbody td:first-child .prj-codice {
      font-size: .68rem; color: #adb5bd; font-family: monospace;
    }
    
		/* Celle ruolo */
    .matrix-table tbody td.role-cell {
      padding: 8px; min-width: 165px; max-width: 190px;
      border-right: 1px solid #e9ecef; border-bottom: 1px solid #e9ecef;
      vertical-align: top;
    }
    
		/* Card risorsa assegnata */
    .role-card {
      background: #f0f7ff; border: 1px solid #c7d9f7;
      border-radius: 8px; padding: 7px 9px; font-size: .78rem;
      display: flex; flex-direction: column; gap: 3px;
      transition: box-shadow .15s, transform .15s;
    }
    .role-card:hover {
      box-shadow: 0 3px 10px rgba(74,127,212,.18);
      transform: translateY(-1px);
    }
    .role-card .rc-nome {
      font-weight: 700; color: #1a2035; font-size: .82rem;
      display: flex; align-items: center; gap: 5px;
    }
    .role-card .rc-row {
      display: flex; align-items: center; gap: 5px; color: #495057;
    }
    .role-card .rc-row i { color: #4a7fd4; width: 13px; text-align: center; flex-shrink: 0; }
    .role-card .rc-doc-ok  { color: #198754; font-weight: 600; }
    .role-card .rc-doc-no  { color: #dc3545; }
    .role-card .rc-nick {
      background: #1a2035; color: #fff; border-radius: 4px;
      padding: 0 5px; font-size: .68rem; line-height: 1.6;
    }
    
		/* Cella vuota */
    .role-empty {
      display: flex; align-items: center; justify-content: center;
      height: 54px; color: #ced4da; font-size: 1.3rem;
    }
    
		/* Righe alternate */
    .matrix-table tbody tr:nth-child(even) td:first-child { background: #f0f2f5; }
    .matrix-table tbody tr:hover td { background: #fafbff !important; }
    .matrix-table tbody tr:hover td:first-child { background: #eef1f8 !important; }
    
		/* Header ruolo colore */
    .matrix-table thead th.rh-commerciale   { border-top: 3px solid #fd7e14; }
    .matrix-table thead th.rh-resp-tecnico  { border-top: 3px solid #6610f2; }
    .matrix-table thead th.rh-resp-it       { border-top: 3px solid #0dcaf0; }
    .matrix-table thead th.rh-analista-tec  { border-top: 3px solid #20c997; }
    .matrix-table thead th.rh-analista-tool { border-top: 3px solid #ffc107; }
    .matrix-table thead th.rh-sviluppatori  { border-top: 3px solid #0d6efd; }
    .matrix-table thead th.rh-auditor       { border-top: 3px solid #dc3545; }
    
		/* Filtri toolbar */
    .matrix-toolbar {
      background: #fff; border-radius: 12px; padding: 14px 18px;
      margin-bottom: 14px; display: flex; align-items: center;
      gap: 12px; flex-wrap: wrap;
      box-shadow: 0 2px 8px rgba(0,0,0,.06);
    }
    .matrix-toolbar .filter-label {
      font-size: .78rem; font-weight: 600;
      color: #6c757d; text-transform: uppercase; letter-spacing: .5px;
    }
		
    /* ── Responsive ─────────────────────────────────── */
    @media (max-width: 768px) {
      #sidebar { transform: translateX(-100%); }
      #sidebar.open { transform: translateX(0); }
      #app { margin-left: 0; }
    }