:root {
  --blue: #06172f;
  --blue-2: #0b2f66;
  --red: #d71920;
  --green: #1f9a42;
  --gold: #fff200;
  --gold-2: #f3d600;
  --ink: #101a2b;
  --muted: #596476;
  --paper: #ffffff;
  --soft: #f5f7fb;
  --line: #e4e9f1;
  --shadow: 0 18px 44px rgba(7, 31, 63, .13);
  --max: 1260px;
  --font: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin:0; font-family:var(--font); color:var(--ink); background:var(--soft); line-height:1.55; }
a { color:inherit; }
.site-header { position:sticky; top:0; z-index:100; background:var(--blue); border-bottom:1px solid rgba(255,255,255,.08); box-shadow:0 8px 26px rgba(4,15,30,.24); }
.nav { max-width:var(--max); margin:0 auto; min-height:78px; padding:10px 22px; display:flex; justify-content:space-between; align-items:center; gap:22px; }
.brand { display:inline-flex; align-items:center; gap:12px; text-decoration:none; color:#fff; min-width:225px; }
.brand-logo { width:74px; height:74px; border-radius:50%; object-fit:contain; background:#fff; border:2px solid rgba(255,255,255,.90); box-shadow:0 5px 18px rgba(0,0,0,.24); }
.brand-text { display:grid; line-height:.92; font-weight:950; letter-spacing:-.03em; text-transform:uppercase; color:#fff; }
.brand-text span:nth-child(1), .brand-text span:nth-child(2) { font-size:1.35rem; }
.brand-text span:nth-child(3) { color:var(--gold); font-size:.86rem; letter-spacing:.02em; margin-top:5px; }
.nav-links { display:flex; align-items:center; justify-content:flex-end; gap:16px; color:#fff; font-size:.86rem; font-weight:900; text-transform:uppercase; }
.nav-links a { text-decoration:none; padding:10px 0; border-bottom:3px solid transparent; }
.nav-links a:hover { color:var(--gold); border-bottom-color:var(--gold); }
.header-cta { display:inline-flex; align-items:center; justify-content:center; padding:10px 18px !important; border:2px solid rgba(255,255,255,.9) !important; border-radius:7px; }
.wrap { max-width:var(--max); margin:0 auto; padding:0 22px; }
.reserved-hero { background:linear-gradient(135deg,var(--blue),var(--blue-2)); color:#fff; padding:42px 0; position:relative; overflow:hidden; }
.reserved-hero::after { content:""; position:absolute; inset:0; background:radial-gradient(circle at 12% 15%, rgba(255,242,0,.17), transparent 24%), radial-gradient(circle at 85% 20%, rgba(215,25,32,.14), transparent 30%); }
.reserved-hero .wrap { position:relative; z-index:1; }
.kicker { color:var(--gold); font-weight:950; text-transform:uppercase; letter-spacing:.08em; font-size:.78rem; }
h1 { margin:4px 0 10px; font-size:clamp(2rem,4vw,3.1rem); line-height:1.02; letter-spacing:-.045em; text-transform:uppercase; }
.hero-lead { max-width:920px; color:rgba(255,255,255,.86); margin:0; font-size:1.08rem; }
.layout { max-width:var(--max); margin:28px auto; padding:0 22px; display:grid; grid-template-columns:330px minmax(0,1fr); gap:22px; align-items:start; }
.tree-panel, .panel, .card, .login-card { background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:0 10px 28px rgba(7,31,63,.08); }
.tree-panel { padding:18px; position:sticky; top:102px; max-height:calc(100vh - 122px); overflow:auto; }
.tree-panel h2 { margin:0 0 4px; color:var(--blue); text-transform:uppercase; font-size:1.1rem; }
.tree-panel p { margin:0 0 14px; color:var(--muted); font-size:.88rem; }
.phase-node { border-top:1px solid var(--line); padding:8px 0; }
.phase-node summary { cursor:pointer; font-weight:900; color:var(--blue); display:grid; grid-template-columns:74px 1fr; gap:8px; align-items:start; list-style:none; }
.phase-node summary::-webkit-details-marker { display:none; }
.code, .activity-code { color:var(--red); font-weight:950; }
.activity-list { list-style:none; margin:8px 0 0; padding:0; display:grid; gap:6px; }
.activity-link { display:grid; grid-template-columns:86px 1fr; gap:5px 8px; text-decoration:none; padding:10px; border-radius:9px; color:var(--ink); background:#f7f9fd; border:1px solid transparent; }
.activity-link em { grid-column:2; color:var(--muted); font-size:.78rem; font-style:normal; }
.activity-link:hover, .activity-link.active { background:#fffbe8; border-color:rgba(255,242,0,.8); }
.main-stack { display:grid; gap:22px; }
.panel { padding:24px; }
.panel h2 { margin:0 0 12px; color:var(--blue); text-transform:uppercase; letter-spacing:-.025em; }
.stats-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.stat { background:#fff; border:1px solid var(--line); border-left:5px solid var(--blue); border-radius:10px; padding:16px; box-shadow:0 8px 20px rgba(7,31,63,.06); }
.stat b { display:block; color:var(--blue); font-size:1.7rem; line-height:1; }
.stat span { color:var(--muted); font-size:.88rem; }
.table-wrap { width:100%; overflow:auto; border:1px solid var(--line); border-radius:10px; }
table { width:100%; border-collapse:collapse; background:#fff; }
th, td { padding:11px 12px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; font-size:.92rem; }
th { background:#f7f9fd; color:var(--blue); text-transform:uppercase; font-size:.75rem; letter-spacing:.05em; }
tr:last-child td { border-bottom:0; }
.badge { display:inline-flex; align-items:center; border-radius:999px; padding:5px 9px; font-size:.76rem; font-weight:900; text-transform:uppercase; }
.badge.ok { background:#e9f8ee; color:#137431; }
.badge.warn { background:#fff8ce; color:#7a6200; }
.badge.bad { background:#ffebec; color:#a30f16; }
.badge.neutral { background:#eef2f8; color:#47546b; }
.gantt { display:grid; gap:10px; }
.gantt-row { display:grid; grid-template-columns:210px minmax(260px,1fr); gap:14px; align-items:center; }
.gantt-label { font-size:.86rem; color:var(--blue); font-weight:800; }
.gantt-track { position:relative; height:28px; background:linear-gradient(90deg,#eef2f8,#f8fafc); border:1px solid var(--line); border-radius:999px; overflow:hidden; }
.gantt-bar { position:absolute; top:3px; bottom:3px; border-radius:999px; background:linear-gradient(90deg,var(--blue),var(--blue-2)); min-width:6px; }
.gantt-row.selected .gantt-bar { background:linear-gradient(90deg,var(--red),var(--gold-2)); }
.gantt-date { display:block; color:var(--muted); font-weight:500; font-size:.78rem; margin-top:2px; }
.icom-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.icom-card { background:#fff; border:1px solid var(--line); border-top:5px solid var(--blue); border-radius:10px; padding:15px; }
.icom-card h3 { margin:0 0 8px; color:var(--blue); text-transform:uppercase; font-size:.95rem; }
.icom-card ul { margin:0; padding-left:18px; color:var(--muted); }
.icom-card li { margin:0 0 8px; }
.form-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; align-items:end; }
label { display:grid; gap:6px; font-weight:850; color:var(--blue); font-size:.86rem; }
input, select, textarea { width:100%; padding:11px 12px; border:1px solid var(--line); border-radius:8px; font:inherit; background:#f7f9fd; color:var(--ink); }
textarea { min-height:76px; resize:vertical; }
.form-wide { grid-column:span 2; }
.btn { display:inline-flex; align-items:center; justify-content:center; min-height:42px; padding:11px 18px; border-radius:7px; border:1px solid transparent; text-decoration:none; font-weight:950; text-transform:uppercase; cursor:pointer; }
.btn-primary { background:var(--gold); color:var(--blue); border-color:var(--gold); }
.btn-blue { background:var(--blue); color:#fff; border-color:var(--blue); }
.alert { padding:12px 14px; border-radius:10px; margin:0 0 14px; }
.alert.error { background:#ffebec; color:#8c1117; }
.alert.ok { background:#e9f8ee; color:#137431; }
.login-page { min-height:100vh; display:grid; place-items:center; padding:28px; background:linear-gradient(135deg,var(--blue),var(--blue-2)); }
.login-card { width:min(520px,100%); padding:28px; }
.login-card h1 { color:var(--blue); font-size:2rem; }
.login-card p { color:var(--muted); }
.login-card form { display:grid; gap:14px; }
.reserved-footer { color:#fff; background:#050f1e; padding:24px 0; margin-top:40px; font-size:.88rem; }
.footer-wrap { display:flex; justify-content:space-between; gap:18px; flex-wrap:wrap; color:rgba(255,255,255,.76); }
.small-note { color:var(--muted); font-size:.86rem; }
@media (max-width: 980px) { .layout { grid-template-columns:1fr; } .tree-panel { position:static; max-height:none; } .stats-grid, .icom-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .form-grid { grid-template-columns:1fr 1fr; } }
@media (max-width: 680px) { .brand-logo { width:54px; height:54px; } .brand-text span:nth-child(1), .brand-text span:nth-child(2) { font-size:1rem; } .nav { align-items:flex-start; } .nav-links { flex-wrap:wrap; font-size:.75rem; } .stats-grid, .icom-grid, .form-grid { grid-template-columns:1fr; } .form-wide { grid-column:span 1; } .gantt-row { grid-template-columns:1fr; } }

.icom-pill { display:inline-flex; align-items:center; border-radius:999px; padding:5px 9px; font-size:.75rem; font-weight:950; text-transform:uppercase; margin:2px 4px 2px 0; }
.icom-pill.input { background:#eaf1ff; color:#17427d; }
.icom-pill.control { background:#fff8ce; color:#756000; }
.icom-pill.output { background:#e9f8ee; color:#137431; }
.icom-pill.mechanism { background:#f1edf9; color:#513a80; }
.resource-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.resource-card { border:1px solid var(--line); border-left:5px solid var(--blue); border-radius:10px; background:#fff; padding:14px; }
.resource-card h3 { margin:4px 0 6px; color:var(--blue); font-size:1rem; }
.resource-card p { margin:0 0 8px; color:var(--muted); font-size:.9rem; }
.form-grid.compact { grid-template-columns:repeat(4,minmax(0,1fr)); }
@media (max-width: 980px) { .resource-list { grid-template-columns:1fr; } .form-grid.compact { grid-template-columns:1fr 1fr; } }
@media (max-width: 680px) { .form-grid.compact { grid-template-columns:1fr; } }
.actions-inline { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }


.btn-small { min-height:32px; padding:7px 10px; font-size:.72rem; }
@media (max-width: 760px) {
  .table-wrap { overflow:visible; border:0; }
  table.responsive-table,
  table.responsive-table thead,
  table.responsive-table tbody,
  table.responsive-table th,
  table.responsive-table td,
  table.responsive-table tr { display:block; width:100%; }
  table.responsive-table thead { display:none; }
  table.responsive-table tr { margin:0 0 12px; border:1px solid var(--line); border-radius:10px; overflow:hidden; background:#fff; box-shadow:0 5px 14px rgba(7,31,63,.05); }
  table.responsive-table td { border-bottom:1px solid var(--line); display:grid; grid-template-columns:42% 1fr; gap:10px; align-items:start; }
  table.responsive-table td:last-child { border-bottom:0; }
  table.responsive-table td::before { content:attr(data-label); font-weight:950; color:var(--blue); text-transform:uppercase; font-size:.72rem; letter-spacing:.04em; }
}


.resource-tree { list-style:none; margin:0; padding-left:18px; border-left:1px solid var(--line); }
.resource-tree > li { margin:6px 0; }
.resource-node { display:inline-block; background:#f7f9fd; border:1px solid var(--line); border-radius:8px; padding:7px 10px; }
.resource-node em { color:var(--muted); font-style:normal; margin-left:6px; font-size:.82rem; }


/* Rev. 0 - documenti senza treeview: la tabella occupa tutto il campo visivo. */
.layout.layout-documents { grid-template-columns: minmax(0, 1fr); }
.layout.layout-documents .main-stack { grid-column: 1 / -1; }
.document-table { table-layout: fixed; }
.document-table th:nth-child(1), .document-table td:nth-child(1) { width: 135px; }
.document-table th:nth-child(2), .document-table td:nth-child(2) { width: auto; }
.document-table th:nth-child(3), .document-table td:nth-child(3) { width: 95px; }
.document-table th:nth-child(4), .document-table td:nth-child(4) { width: 135px; }
.document-table th:nth-child(5), .document-table td:nth-child(5) { width: 96px; }
.document-table th:nth-child(6), .document-table td:nth-child(6) { width: 130px; }
.document-table th:nth-child(7), .document-table td:nth-child(7) { width: 95px; }
.document-table th:nth-child(8), .document-table td:nth-child(8) { width: 105px; }
.document-table th:nth-child(9), .document-table td:nth-child(9) { width: 90px; }
.doc-code-link { font-weight: 950; color: var(--red); text-decoration: none; }
.doc-code-link:hover { text-decoration: underline; }
.doc-title-cell { overflow-wrap: anywhere; }
.document-table td { font-size: .86rem; }
.document-table th { font-size: .68rem; }
@media (max-width: 1180px) {
  .document-table { table-layout: auto; }
}


/* Rev. 0.1 - menu smartphone area riservata allineato alla home pubblica. */
.menu-toggle { display:none; background:transparent; border:0; color:#fff; padding:10px; cursor:pointer; }
.menu-toggle svg { width:32px; height:32px; }
.mobile-menu { display:none; max-width:var(--max); margin:0 auto; padding:0 22px 18px; background:var(--blue); }
.mobile-menu.open { display:block; }
.mobile-menu a { display:block; padding:14px 0; color:#fff; font-weight:900; text-transform:uppercase; text-decoration:none; border-top:1px solid rgba(255,255,255,.16); }
.mobile-menu .header-cta { display:inline-flex; margin-top:12px; color:#fff; padding:10px 18px !important; border:2px solid rgba(255,255,255,.9) !important; border-radius:7px; }
@media (max-width: 1050px) {
  .nav-links { display:none; }
  .menu-toggle { display:inline-flex; }
  .nav { min-height:72px; }
}
@media (max-width: 680px) {
  .nav { align-items:center; }
}

/* Rev. 0.2 - correzione tabella Risorse: niente sovrapposizione Nome/Padre.
   La tabella resta sintetica su PC e diventa verticale su smartphone tramite la regola responsive-table già presente. */
.layout.layout-resources { grid-template-columns:minmax(0,1fr); }
.layout.layout-resources .main-stack { grid-column:1 / -1; }
.resource-filters { grid-template-columns:1.4fr 1fr 1fr .9fr auto auto; }

/* La tabella deve avere una base minima reale: se lo spazio si riduce, compare lo scroll orizzontale
   invece di comprimere Nome e Padre uno sopra l'altro. */
.resource-table {
  table-layout:fixed;
  width:100%;
  min-width:1180px;
}
.resource-table th,
.resource-table td {
  overflow-wrap:anywhere;
  word-break:normal;
  white-space:normal;
  line-height:1.45;
}
.resource-table th:nth-child(1), .resource-table td:nth-child(1) { width:128px; }  /* Codice */
.resource-table th:nth-child(2), .resource-table td:nth-child(2) { width:118px; }  /* Tipo */
.resource-table th:nth-child(3), .resource-table td:nth-child(3) { width:245px; }  /* Nome risorsa */
.resource-table th:nth-child(4), .resource-table td:nth-child(4) { width:155px; }  /* Padre */
.resource-table th:nth-child(5), .resource-table td:nth-child(5) { width:118px; }  /* Stato */
.resource-table th:nth-child(6), .resource-table td:nth-child(6) { width:145px; }  /* Ruolo */
.resource-table th:nth-child(7), .resource-table td:nth-child(7) { width:135px; }  /* Ambito */
.resource-table th:nth-child(8), .resource-table td:nth-child(8) { width:118px; }  /* Responsabile */
.resource-table th:nth-child(9), .resource-table td:nth-child(9) { width:68px; }   /* Ore */
.resource-table th:nth-child(10), .resource-table td:nth-child(10) { width:90px; } /* Collegamenti */
.resource-table td { font-size:.84rem; }
.resource-table th { font-size:.66rem; }
.resource-table .resource-name {
  display:block;
  font-weight:700;
  color:var(--ink);
}
.resource-table .resource-email,
.resource-table .resource-parent-name {
  display:block;
  margin-top:4px;
}

.resource-detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.resource-detail-grid article { border:1px solid var(--line); border-radius:10px; padding:14px; background:#fff; }
.resource-detail-grid h3 { margin:0 0 8px; color:var(--blue); text-transform:uppercase; font-size:.95rem; }
.resource-detail-grid ul { margin:0; padding-left:18px; }
.resource-detail-grid li { margin-bottom:8px; }

@media (max-width: 1180px) {
  .resource-table { min-width:1120px; }
  .resource-filters { grid-template-columns:1fr 1fr; }
}
@media (max-width: 760px) {
  .resource-table { min-width:0; width:100%; }
  .resource-detail-grid { grid-template-columns:1fr; }
}

/* Rev. 0.3 - sezioni modifica dati riservate ad amministratore */
.admin-edit-panel {
  border-left: 5px solid var(--red);
  background: linear-gradient(180deg, #fff, #fffdf3);
}
.admin-readonly-note {
  border-left: 5px solid var(--gold-2);
  background: #fffdf3;
}
.admin-form textarea { min-height: 92px; }
.admin-form input[required] { border-left: 4px solid var(--red); }

/* Rev. 0.4 - amministrazione controllata, ruoli, audit trail e gestione concorrente. */
.alert.warn { background:#fff8ce; color:#6c5900; }
.btn-admin { background:var(--red); color:#fff; border-color:var(--red); }
.btn-admin:hover, .btn-danger:hover { filter:brightness(.94); }
.btn-danger { background:#a30f16; color:#fff; border-color:#a30f16; }
.admin-nav-link { color:var(--gold) !important; }
.user-chip { display:inline-flex; align-items:center; max-width:180px; padding:7px 10px; border:1px solid rgba(255,255,255,.28); border-radius:999px; color:#fff; font-size:.74rem; text-transform:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hero-actions { display:flex; gap:10px; margin-top:18px; position:relative; z-index:2; }
.access-summary { margin:14px 0 0; color:var(--muted); }
.role-badge, .operation-badge { display:inline-flex; align-items:center; border-radius:999px; padding:5px 9px; font-size:.73rem; font-weight:950; text-transform:uppercase; }
.role-admin { background:#ffebec; color:#9a1117; }
.role-member { background:#eef2f8; color:#47546b; }
.operation-insert, .operation-login { background:#e9f8ee; color:#137431; }
.operation-update, .operation-password_reset { background:#fff8ce; color:#6c5900; }
.operation-delete { background:#ffebec; color:#9a1117; }
.operation-logout { background:#eef2f8; color:#47546b; }
.layout.layout-admin { grid-template-columns:minmax(0,1fr); }
.layout.layout-admin .main-stack { grid-column:1 / -1; }
.admin-hero { background:linear-gradient(135deg,#2a0710,var(--blue)); }
.admin-control-panel { border-top:5px solid var(--red); }
.admin-module-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.admin-module-card { display:flex; flex-direction:column; gap:10px; border:1px solid var(--line); border-radius:10px; padding:16px; background:#fff; }
.admin-module-card h3 { margin:0; color:var(--blue); text-transform:uppercase; }
.admin-module-card p { margin:0; color:var(--muted); flex:1; }
.integrity-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.integrity-card { display:flex; justify-content:space-between; gap:12px; align-items:center; border:1px solid var(--line); border-left:5px solid var(--blue); border-radius:10px; padding:16px; }
.integrity-ok { border-left-color:var(--green); background:#f6fff8; }
.integrity-bad { border-left-color:var(--red); background:#fff7f7; }
.technical-details, .audit-details { margin-top:10px; }
.technical-details summary, .audit-details summary { cursor:pointer; color:var(--blue); font-weight:900; }
.technical-details pre, .audit-details pre { max-width:100%; overflow:auto; padding:10px; background:#081629; color:#eef6ff; border-radius:8px; font-size:.76rem; white-space:pre-wrap; word-break:break-word; }
.admin-log-filters { grid-template-columns:1fr 1fr 1.2fr auto auto auto !important; }
.audit-table { min-width:1080px; }
.audit-json-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; min-width:620px; margin-top:8px; }
.panel-heading-actions { display:flex; justify-content:space-between; gap:18px; align-items:flex-start; }
.panel-heading-actions h2 { margin-bottom:4px; }
.panel-heading-actions p { margin:0; }
.danger-panel { border-left:5px solid #a30f16; background:#fff8f8; }
.delete-form { margin-top:18px; padding-top:18px; border-top:1px solid var(--line); }
.admin-edit-panel { scroll-margin-top:110px; }
#ore-attivita, #modifica-ore { scroll-margin-top:110px; }

@media (max-width:1100px) {
  .admin-module-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .admin-log-filters { grid-template-columns:1fr 1fr !important; }
}
@media (max-width:760px) {
  .admin-module-grid, .integrity-grid, .audit-json-grid { grid-template-columns:1fr; min-width:0; }
  .panel-heading-actions { flex-direction:column; }
  .user-chip { display:none; }
  .audit-table { min-width:0; }
}


/* Rev. 0.5 - architettura permanente P0-P9, progetti e guida contestuale. */
.schema-chip { display:inline-flex; margin-top:14px; padding:6px 10px; border:1px solid rgba(255,255,255,.28); border-radius:999px; color:#fff; font-size:.78rem; font-weight:850; }
.process-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.process-map-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.process-card, .project-card { display:flex; flex-direction:column; gap:10px; background:#fff; border:1px solid var(--line); border-top:5px solid var(--blue); border-radius:12px; padding:18px; box-shadow:0 8px 22px rgba(7,31,63,.06); }
.process-card h2, .process-card h3, .project-card h2 { margin:0; color:var(--blue); text-transform:none; }
.process-card p, .project-card p { margin:0; color:var(--muted); }
.process-card .btn, .project-card .btn { align-self:flex-start; margin-top:auto; }
.process-card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.process-code-large, .project-code { color:var(--red); font-size:1.2rem; font-weight:950; letter-spacing:.03em; }
.process-metrics { display:flex; flex-wrap:wrap; gap:7px; margin:4px 0 8px; }
.process-metrics span { background:#f3f6fb; border:1px solid var(--line); border-radius:999px; padding:5px 8px; color:var(--muted); font-size:.75rem; font-weight:800; }
.mini-definition, .process-definition { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px 14px; margin:8px 0 12px; }
.mini-definition div, .process-definition div { border-left:3px solid var(--gold-2); padding-left:9px; }
.mini-definition dt, .process-definition dt { color:var(--muted); font-size:.72rem; text-transform:uppercase; font-weight:900; }
.mini-definition dd, .process-definition dd { margin:1px 0 0; color:var(--ink); font-weight:750; }
.dashboard-split { align-items:start; }
.summary-row { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; padding:11px 0; border-bottom:1px solid var(--line); }
.summary-row:last-child { border-bottom:0; }
.summary-row > div { display:grid; gap:3px; }
.summary-row span:not(.badge) { color:var(--muted); font-size:.82rem; }
.process-nav-list { display:grid; gap:7px; }
.process-nav-link { display:grid; grid-template-columns:44px 1fr; gap:9px; padding:10px; border:1px solid var(--line); border-radius:9px; background:#f7f9fd; text-decoration:none; }
.process-nav-link:hover, .process-nav-link.active { background:#fffbe8; border-color:var(--gold-2); }
.process-nav-link strong { display:block; color:var(--blue); font-size:.82rem; line-height:1.25; }
.process-nav-link em { display:block; color:var(--muted); font-size:.72rem; font-style:normal; margin-top:3px; }
.process-code { color:var(--red); font-weight:950; }
.process-map-link { margin-top:14px; width:100%; }
.phase-status { display:block; color:var(--muted); font-size:.7rem; font-style:normal; font-weight:650; margin-top:3px; }
.help-box { background:#f8fbff; border:1px solid #cedbef; border-left:5px solid var(--blue-2); border-radius:10px; padding:0 14px; }
.help-box summary { cursor:pointer; padding:12px 0; color:var(--blue); font-weight:950; }
.help-box summary span { display:inline-grid; place-items:center; width:22px; height:22px; border-radius:50%; color:#fff; background:var(--blue); margin-right:5px; }
.help-short { margin:0 0 7px; color:var(--blue); font-weight:800; }
.help-long { padding:0 0 13px; color:var(--muted); }
.icom-input { border-top-color:#17427d; }
.icom-control { border-top-color:#d3b200; }
.icom-output { border-top-color:#137431; }
.icom-mechanism { border-top-color:#6d4b95; }
.admin-inline-form { margin-top:18px; padding-top:16px; border-top:1px solid var(--line); }
.inline-delete-form { display:inline; margin-left:7px; }
.text-button { border:0; background:transparent; cursor:pointer; padding:0; font:inherit; text-decoration:underline; }
.danger-text { color:var(--red); font-size:.73rem; }
progress { width:100%; max-width:160px; accent-color:var(--blue-2); }
.project-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.phase-summary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.phase-summary-card { border:1px solid var(--line); border-left:5px solid var(--blue); border-radius:10px; padding:14px; display:grid; gap:7px; }
.phase-summary-card h3, .phase-summary-card p { margin:0; }
.phase-summary-card p, .phase-summary-card small { color:var(--muted); }
.guide-list { display:grid; gap:22px; }
.guide-group { border-top:4px solid var(--blue); padding-top:12px; }
.guide-entry { padding:15px 0; border-bottom:1px solid var(--line); }
.guide-entry:last-child { border-bottom:0; }
.guide-entry h3 { margin:6px 0; color:var(--blue); }
.guide-entry p { margin:5px 0; }
.guide-entry small { color:var(--muted); }
.guide-entry-head { display:flex; justify-content:space-between; gap:12px; }
.guide-code { color:var(--red); font-weight:950; }
pre { max-width:100%; overflow:auto; white-space:pre-wrap; word-break:break-word; }
.nav-links { gap:12px; font-size:.79rem; }
@media (max-width:1100px) {
  .process-grid, .process-map-grid, .project-grid { grid-template-columns:1fr; }
}
@media (max-width:760px) {
  .process-grid, .project-grid, .phase-summary-grid, .mini-definition, .process-definition { grid-template-columns:1fr; }
  .summary-row { flex-direction:column; }
}

/* Rev. 0.5.2 - pagina dedicata della singola risorsa e cruscotto ore/attività/processi. */
.resource-workspace-layout { grid-template-columns:310px minmax(0,1fr); }
.resource-workspace-main { min-width:0; }
.resource-navigation { padding:16px; }
.resource-nav-tree { display:grid; gap:7px; }
.resource-nav-tree details { border-top:1px solid var(--line); padding-top:7px; }
.resource-nav-tree summary { cursor:pointer; color:var(--blue); font-weight:950; text-transform:uppercase; font-size:.78rem; letter-spacing:.04em; padding:7px 4px; }
.resource-nav-item,
.resource-nav-subitem { display:flex; align-items:center; justify-content:space-between; gap:10px; text-decoration:none; border:1px solid transparent; border-radius:9px; padding:10px 11px; background:#f7f9fd; color:var(--ink); }
.resource-nav-subitem { margin:5px 0 0 14px; font-size:.88rem; }
.resource-nav-item em,
.resource-nav-subitem em { color:var(--muted); font-style:normal; font-size:.75rem; text-align:right; }
.resource-nav-item:hover,
.resource-nav-subitem:hover,
.resource-nav-item.active,
.resource-nav-subitem.active { background:#fffbe8; border-color:rgba(243,214,0,.85); }
.resource-nav-item.admin { border-left:4px solid var(--red); }
.resource-period-panel { padding-top:18px; padding-bottom:18px; }
.resource-period-form { display:flex; align-items:end; gap:10px; }
.resource-period-form label { min-width:180px; }
.resource-stats-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
.month-chart { display:grid; grid-template-columns:repeat(12,minmax(42px,1fr)); gap:8px; min-height:250px; align-items:end; padding-top:20px; overflow-x:auto; }
.month-column { min-width:42px; display:grid; grid-template-rows:auto 180px auto; gap:6px; text-align:center; }
.month-value { color:var(--blue); font-size:.75rem; font-weight:900; }
.month-track { height:180px; border:1px solid var(--line); border-radius:8px 8px 3px 3px; background:linear-gradient(180deg,#f7f9fd,#eef2f8); display:flex; align-items:flex-end; overflow:hidden; }
.month-bar { width:100%; min-height:0; background:linear-gradient(180deg,var(--blue-2),var(--blue)); border-radius:6px 6px 0 0; }
.month-label { color:var(--muted); font-size:.75rem; font-weight:850; }
.metric-bars { display:grid; gap:10px; }
.metric-bar-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; text-decoration:none; border:1px solid var(--line); border-radius:9px; padding:10px; background:#fff; }
.metric-bar-row:hover { border-color:var(--gold-2); background:#fffdf3; }
.metric-label { color:var(--ink); font-size:.86rem; overflow-wrap:anywhere; }
.metric-value { color:var(--blue); font-weight:950; font-size:.84rem; }
.metric-track { grid-column:1 / -1; display:block; height:8px; border-radius:999px; background:#eef2f8; overflow:hidden; }
.metric-track > span { display:block; height:100%; min-width:3px; border-radius:999px; background:linear-gradient(90deg,var(--blue),var(--blue-2)); }
.panel-heading-actions { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.panel-heading-actions h2 { margin-bottom:4px; }
.detail-definition-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.detail-definition-grid > div { border:1px solid var(--line); border-radius:9px; padding:12px; background:#f9fbfe; display:grid; gap:5px; }
.detail-definition-grid > div.wide { grid-column:1 / -1; }
.detail-definition-grid span { color:var(--muted); font-size:.76rem; text-transform:uppercase; font-weight:900; letter-spacing:.04em; }
.detail-definition-grid strong { color:var(--ink); overflow-wrap:anywhere; }
.resource-activity-filters { grid-template-columns:1fr 1.6fr 1.2fr auto auto; }
.resource-hour-filters { grid-template-columns:1fr 1.8fr auto auto; }
.resource-master-detail { display:grid; grid-template-columns:minmax(290px,.8fr) minmax(0,1.45fr); gap:22px; align-items:start; }
.resource-activity-list-panel { position:sticky; top:102px; max-height:calc(100vh - 122px); overflow:auto; }
.resource-activity-list { display:grid; gap:7px; }
.resource-activity-item { display:grid; gap:4px; text-decoration:none; padding:11px; border:1px solid var(--line); border-radius:9px; background:#f7f9fd; }
.resource-activity-item strong { color:var(--red); }
.resource-activity-item em { color:var(--muted); font-size:.77rem; font-style:normal; }
.resource-activity-item:hover,
.resource-activity-item.active { background:#fffbe8; border-color:var(--gold-2); }
.activity-preview-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; border-bottom:1px solid var(--line); padding-bottom:14px; margin-bottom:14px; }
.activity-preview-head h3 { margin:4px 0 0; color:var(--blue); font-size:1.08rem; }
.preview-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin:14px 0; }
.preview-kpis > div { border:1px solid var(--line); border-radius:9px; padding:10px; background:#f7f9fd; }
.preview-kpis span { display:block; color:var(--muted); font-size:.72rem; text-transform:uppercase; font-weight:900; }
.preview-kpis strong { display:block; color:var(--blue); font-size:1.05rem; }
.preview-subtitle { margin:24px 0 10px; color:var(--blue); text-transform:uppercase; font-size:.95rem; }
.resource-process-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.linked-record-list { list-style:none; padding:0; margin:0; display:grid; gap:8px; }
.linked-record-list li { display:grid; gap:3px; padding:10px; border:1px solid var(--line); border-radius:9px; background:#f7f9fd; }
.linked-record-list a { text-decoration:none; }
.linked-record-list a:hover { text-decoration:underline; }
.linked-record-list span { color:var(--muted); font-size:.78rem; }
.resource-breadcrumb { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.resource-breadcrumb a { text-decoration:none; border:1px solid var(--line); border-radius:999px; padding:7px 10px; background:#f7f9fd; }
.resource-breadcrumb span { color:var(--muted); }
.resource-child-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.resource-child-card { display:grid; gap:5px; text-decoration:none; padding:14px; border:1px solid var(--line); border-left:5px solid var(--blue); border-radius:10px; background:#fff; }
.resource-child-card:hover { border-color:var(--gold-2); }
.resource-child-card strong { color:var(--red); }
.resource-child-card em { color:var(--muted); font-size:.78rem; font-style:normal; }

@media (max-width:1100px) {
  .resource-master-detail { grid-template-columns:1fr; }
  .resource-activity-list-panel { position:static; max-height:none; }
  .resource-process-grid { grid-template-columns:1fr; }
  .preview-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .resource-child-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:980px) {
  .resource-workspace-layout { grid-template-columns:1fr; }
  .resource-navigation { position:static; max-height:none; }
  .resource-stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .resource-activity-filters,
  .resource-hour-filters { grid-template-columns:1fr 1fr; }
}
@media (max-width:680px) {
  .resource-stats-grid,
  .detail-definition-grid,
  .preview-kpis,
  .resource-child-grid { grid-template-columns:1fr; }
  .detail-definition-grid > div.wide { grid-column:auto; }
  .resource-activity-filters,
  .resource-hour-filters { grid-template-columns:1fr; }
  .panel-heading-actions { display:grid; }
  .resource-period-form { width:100%; }
  .resource-period-form label { width:100%; min-width:0; }
}

/* Utilità di griglia impiegate dal cruscotto generale e dal cruscotto risorsa. */
.grid { display:grid; gap:22px; }
.grid-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
@media (max-width:980px) { .grid-2 { grid-template-columns:1fr; } }

/* Rev. 0.5.3 - distinzione attività permanenti / attività di progetto nelle schede processo. */
.process-activity-filters {
  grid-template-columns:minmax(180px,1.15fr) minmax(190px,1.15fr) auto auto;
  align-items:end;
  margin:14px 0 8px;
}
.activity-filter-summary {
  margin:0 0 14px;
  color:var(--muted);
  font-size:.86rem;
}
.activity-origin-badge {
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:5px 9px;
  font-size:.72rem;
  font-weight:950;
  text-transform:uppercase;
  letter-spacing:.025em;
}
.activity-origin-badge.origin-permanent {
  background:#e9f8ee;
  color:#137431;
  border:1px solid #bfe7ca;
}
.activity-origin-badge.origin-project {
  background:#eef2f8;
  color:#334b72;
  border:1px solid #d4ddec;
}
.activity-origin-link {
  display:inline-block;
  margin-top:5px;
  color:var(--blue);
  font-weight:850;
  text-decoration:none;
}
.activity-origin-link:hover { text-decoration:underline; text-underline-offset:3px; }
.activity-origin-detail {
  color:var(--muted);
  font-size:.78rem;
}
@media (max-width:900px) {
  .process-activity-filters { grid-template-columns:1fr 1fr; }
}
@media (max-width:620px) {
  .process-activity-filters { grid-template-columns:1fr; }
}

/* Gestione News Rev. 0.6.0 */
.news-stats { grid-template-columns:repeat(4,minmax(0,1fr)); }
.public-model-status { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:16px; padding:14px; border:1px solid var(--line); border-radius:10px; background:var(--soft); font-size:.9rem; }
.public-model-status details { width:100%; }
.public-model-status code { word-break:break-all; }
.inline-form { display:inline-flex; margin:0; }
.news-action-stack { display:flex; flex-direction:column; align-items:stretch; gap:6px; min-width:138px; }
.news-action-stack .btn, .news-action-stack form, .news-action-stack button { width:100%; }
.news-admin-table td { min-width:145px; }
.news-admin-table td:nth-child(2) { min-width:270px; }
.news-editor-grid .form-wide { grid-column:span 4; }
.checkbox-label { display:flex !important; flex-direction:row !important; align-items:center; gap:9px; min-height:42px; }
.checkbox-label input[type="checkbox"] { width:20px; height:20px; }
.news-preview-card { display:grid; grid-template-columns:minmax(230px,.8fr) minmax(0,1.4fr); border:1px solid var(--line); border-radius:14px; overflow:hidden; box-shadow:0 12px 32px rgba(7,31,63,.10); }
.news-preview-media { min-height:300px; padding:28px; display:flex; flex-direction:column; justify-content:flex-end; gap:8px; color:#fff; background:linear-gradient(145deg,var(--blue-2),var(--blue)); background-size:cover; background-position:center; }
.news-preview-media span { font-size:.76rem; font-weight:950; letter-spacing:.07em; text-transform:uppercase; }
.news-preview-media strong { font-size:1.35rem; text-transform:uppercase; }
.news-preview-content { padding:32px; }
.news-preview-content h2 { margin:8px 0 14px; font-size:1.8rem; text-transform:none; }
.news-preview-content p { color:var(--muted); line-height:1.65; }
.news-preview-meta { display:flex; flex-wrap:wrap; gap:10px; color:var(--muted); font-size:.84rem; text-transform:uppercase; font-weight:900; }
.news-preview-source { border-top:1px solid var(--line); padding-top:16px; }
.check-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.check-grid > div { border:1px solid var(--line); border-radius:10px; padding:14px; display:flex; flex-direction:column; gap:5px; }
.check-grid span { color:var(--muted); }
@media (max-width:980px) { .news-stats { grid-template-columns:repeat(2,minmax(0,1fr)); } .news-editor-grid .form-wide { grid-column:span 2; } .news-preview-card { grid-template-columns:1fr; } .news-preview-media { min-height:220px; } .check-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:680px) { .news-stats,.check-grid { grid-template-columns:1fr; } .news-editor-grid .form-wide { grid-column:span 1; } .public-model-status { align-items:flex-start; } }
