/* #81: ADMIN → Utenti e accessi → Modelli di permessi (permission-templates-view.js). */
.users-tabs{display:flex;gap:6px;margin:0 0 14px;border-bottom:1px solid var(--line)}
.users-tab{border:0;background:none;padding:10px 14px;margin-bottom:-1px;border-bottom:2px solid transparent;font:600 13px 'DM Sans';color:var(--muted);cursor:pointer}
.users-tab.active{color:var(--brand);border-bottom-color:var(--brand)}
.users-tab-count{display:inline-block;min-width:18px;margin-left:4px;padding:0 6px;border-radius:999px;background:#f3e8e7;color:var(--brand);font-size:10px;line-height:17px;text-align:center}
.user-row-actions{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end}
.user-row-actions .btn{white-space:nowrap}
.user-template-badge{display:block;width:max-content;max-width:100%;margin-top:5px;padding:3px 7px;border-radius:999px;background:#f3e8e7;color:var(--brand);font-size:9px;font-weight:700}
.user-template-badge.differs{background:#fff4d6;color:#7a5a00}
.templates-list{display:grid;gap:12px;padding:16px 22px 22px}
.templates-empty{padding:18px;border:1px dashed var(--line);border-radius:12px;text-align:center;color:var(--muted);font-size:12px;line-height:1.5}
.template-item{display:grid;gap:10px;padding:14px 16px;border:1px solid var(--line);border-radius:12px;background:#fff}
.template-item-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap}
.template-item h4{margin:0;font-size:14px}
.template-item-head p{margin:3px 0 0;font-size:11px;color:var(--muted)}
.template-default{display:inline-block;margin-left:4px;padding:1px 7px;border-radius:999px;background:var(--brand);color:#fff;font-size:9px;font-weight:700}
.template-actions{display:flex;gap:6px;flex-wrap:wrap}
.template-meta{display:flex;flex-wrap:wrap;gap:4px 14px;margin:0;font-size:11px;color:var(--muted)}
dialog.template-modal{width:min(780px,calc(100vw - 30px))}
#templateForm .wide{grid-column:1/-1}
#templateForm select{width:100%;display:block;margin-top:6px;border:1px solid var(--line);border-radius:9px;padding:10px 11px;font:12px 'DM Sans';background:#fff}
.template-default-field{display:grid;gap:4px;align-content:end}
.template-default-field span{display:flex;align-items:center;gap:7px}
.template-default-field input{width:auto!important;margin:0!important}
.template-default-field small,.template-hint{font-size:10px;font-weight:400;color:var(--muted);line-height:1.4;margin:0}
.template-commission-field[hidden]{display:none!important}
.template-admin-warning{margin:0;padding:9px 12px;border-radius:10px;background:#fff4d6;color:#7a5a00;font-size:11px}
.template-admin-warning[hidden]{display:none}
#templateApplyForm{display:grid;gap:14px}
#templateApplyForm input[type="checkbox"],#templateApplyForm input[type="radio"]{width:auto!important;flex:0 0 auto;margin:2px 0 0!important}
#templateApplyForm label>span{flex:1 1 auto;text-align:left}
.template-apply-note{margin:0;padding:10px 12px;border-radius:10px;background:#fbf7f6;border:1px solid var(--line);font-size:12px;line-height:1.45}
.template-apply-note[hidden]{display:none}
.template-apply-mode{display:grid;grid-template-columns:1fr 1fr;gap:10px;border:0;padding:0;margin:0}
.template-apply-mode legend{font-size:11px;font-weight:700;margin-bottom:6px}
.template-apply-mode label{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border:1px solid var(--line);border-radius:10px;cursor:pointer}
.template-apply-mode label:has(input:checked){border-color:var(--brand);background:#fbf7f6}
.template-apply-mode span{display:grid;gap:3px}
.template-apply-mode b{font-size:12px}
.template-apply-mode small{font-size:10px;color:var(--muted);line-height:1.4}
.template-apply-users,.template-apply-preview{display:grid;gap:8px}
.template-apply-users-head{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
.template-apply-users-head span{display:flex;gap:6px;flex-wrap:wrap}
.template-apply-users>small{font-size:10px;color:var(--muted)}
.template-apply-list{display:grid;grid-template-columns:1fr 1fr;gap:6px;max-height:230px;overflow:auto;padding:2px}
.template-apply-list label{display:flex;gap:8px;align-items:flex-start;padding:8px 10px;border:1px solid var(--line);border-radius:9px;font-size:12px}
.template-apply-list span{display:grid;gap:2px;min-width:0}
.template-apply-list small{font-size:10px;color:var(--muted);overflow-wrap:anywhere}
.template-apply-preview>p{margin:0;font-size:12px;font-weight:700;color:var(--brand)}
#templateApplyPreview{display:grid;gap:6px;max-height:260px;overflow:auto}
.template-preview-row{display:grid;gap:5px;padding:8px 10px;border:1px solid var(--line);border-radius:9px;font-size:12px}
.template-preview-row.same>span,.template-preview-row.skipped>span{font-size:11px;color:var(--muted)}
.template-preview-row.skipped{background:#f6f6f6}
.template-preview-changes{display:flex;flex-wrap:wrap;gap:4px}
.template-preview-changes span{padding:3px 6px;border-radius:5px;font-size:10px;font-weight:700}
.template-preview-changes .added{background:#e3f3ea;color:#1d6b40}
.template-preview-changes .removed{background:#fbe4e2;color:#8f332c}
.template-preview-changes .scope{background:#eef0f7;color:#33406b}
.template-preview-warning{font-size:10px;color:#7a5a00}
#userForm .permission-template-field select{width:100%;display:block;margin-top:6px;border:1px solid var(--line);border-radius:9px;padding:10px 11px;font:12px 'DM Sans';background:#fff}
#userForm .permission-template-field small{display:block;margin-top:6px;color:var(--muted);font-size:10px;font-weight:500;line-height:1.35}
@media(max-width:650px){.template-apply-mode,.template-apply-list{grid-template-columns:1fr}}
