/* ==========================================================
   STUDIO M GRECO - CMS Amministrazione
   Foglio di stile principale
   Palette professionale: navy + grigio + azzurro accento
   ========================================================== */

:root {
    --sg-navy:        #1e3a5f;   /* blu navy primario - barra superiore */
    --sg-navy-dark:   #16293f;   /* navy scuro - hover/active */
    --sg-navy-light:  #2c4f7f;   /* navy chiaro - bordi/separatori */
    --sg-blue:        #0d6efd;   /* azzurro accento - link/pulsanti */
    --sg-blue-hover:  #0b5ed7;
    --sg-bg:          #f5f7fa;   /* sfondo neutro */
    --sg-bg-card:     #ffffff;   /* sfondo cards */
    --sg-border:      #e3e6ec;   /* bordi chiari */
    --sg-text:        #1f2d3d;   /* testo principale */
    --sg-text-muted:  #6c7a89;   /* testo secondario */
    --sg-success:     #198754;
    --sg-warning:     #f59f00;
    --sg-danger:      #dc3545;
    --sg-info:        #0dcaf0;
    --sg-sidebar-w:   240px;
    --sg-topbar-h:    58px;
    --sg-radius:      8px;
    --sg-shadow:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

/* ==========================================================
   Reset / base
   ========================================================== */
html, body {
    height: 100%;
}
body {
    background: var(--sg-bg);
    color: var(--sg-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--sg-blue); text-decoration: none; }
a:hover { color: var(--sg-blue-hover); text-decoration: underline; }

/* ==========================================================
   Layout admin (Site.Master)
   ========================================================== */
.sg-shell {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sg-sidebar {
    width: var(--sg-sidebar-w);
    background: var(--sg-navy);
    color: #cfd9e6;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.sg-sidebar .sg-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--sg-navy-light);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-decoration: none;
    height: var(--sg-topbar-h);
}
.sg-sidebar .sg-brand i { font-size: 22px; color: #fff; }
.sg-sidebar .sg-brand .sg-brand-text { line-height: 1.1; }
.sg-sidebar .sg-brand .sg-brand-text small { display:block; font-size: 11px; opacity: .75; font-weight: 400; }

.sg-nav { padding: 8px 0; flex: 1; }
.sg-nav-section {
    padding: 10px 18px 4px 18px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8b9bb1;
}
.sg-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    color: #cfd9e6;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}
.sg-nav a i { font-size: 16px; width: 18px; text-align: center; }
.sg-nav a:hover { background: var(--sg-navy-dark); color: #fff; text-decoration: none; }
.sg-nav a.active {
    background: var(--sg-navy-dark);
    color: #fff;
    border-left-color: var(--sg-blue);
}

.sg-sidebar-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--sg-navy-light);
    font-size: 11px;
    color: #8b9bb1;
}

/* --- Topbar --- */
.sg-topbar {
    position: fixed;
    top: 0;
    left: var(--sg-sidebar-w);
    right: 0;
    height: var(--sg-topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--sg-border);
    display: flex;
    align-items: center;
    padding: 0 22px;
    z-index: 1020;
    box-shadow: var(--sg-shadow);
}
.sg-topbar .sg-page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--sg-text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.sg-topbar .sg-page-title i { color: var(--sg-blue); font-size: 18px; }
.sg-topbar .sg-spacer { flex: 1; }
/* Menu utente in topbar (avatar + nominativo cliccabili -> dropdown) */
.sg-topbar .sg-user-menu { position: relative; }
.sg-topbar .sg-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sg-text);
    /* reset del <button> */
    background: transparent;
    border: 1px solid transparent;
    border-radius: 30px;
    padding: 3px 6px 3px 12px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.sg-topbar .sg-user:hover { background: #f5f7fa; border-color: var(--sg-border); }
.sg-topbar .sg-user-menu.show .sg-user { background: #f5f7fa; border-color: var(--sg-border); }
.sg-topbar .sg-user .sg-user-name { font-weight: 500; line-height: 1.1; }
.sg-topbar .sg-user .sg-user-role { font-size: 11px; color: var(--sg-text-muted); display: block; text-transform: capitalize; }
.sg-topbar .sg-user .sg-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--sg-navy);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}
.sg-topbar .sg-user .sg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sg-topbar .sg-user .sg-user-caret { font-size: 12px; color: var(--sg-text-muted); transition: transform .15s; }
.sg-topbar .sg-user-menu.show .sg-user .sg-user-caret { transform: rotate(180deg); }

/* Dropdown menu utente (stesso look della campanella) */
.sg-user-dropdown {
    position: absolute;
    top: 52px;
    right: 0;
    width: 240px;
    max-width: 90vw;
    background: #fff;
    border: 1px solid var(--sg-border);
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(0,0,0,.18);
    z-index: 1050;
    display: none;
    overflow: hidden;
    padding: 6px;
}
.sg-user-dropdown.show { display: block; }
.sg-user-dd-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--sg-border);
}
.sg-user-dd-head .sg-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--sg-navy); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; flex-shrink: 0;
}
.sg-user-dd-info { min-width: 0; }
.sg-user-dd-info .sg-user-name { font-weight: 600; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-user-dd-info .sg-user-role { font-size: 11px; color: var(--sg-text-muted); display: block; text-transform: capitalize; }
.sg-user-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--sg-text);
    text-decoration: none;
    font-size: 14px;
    transition: background .12s;
}
.sg-user-dd-item:hover { background: #f5f7fa; }
.sg-user-dd-item i { font-size: 16px; color: var(--sg-text-muted); }
.sg-user-dd-item.sg-user-dd-danger { color: var(--sg-danger); }
.sg-user-dd-item.sg-user-dd-danger i { color: var(--sg-danger); }
.sg-user-dd-item.sg-user-dd-danger:hover { background: rgba(220,53,69,.08); }

/* --- Main content --- */
.sg-main {
    margin-left: var(--sg-sidebar-w);
    padding: calc(var(--sg-topbar-h) + 22px) 22px 22px 22px;
    width: 100%;
    min-height: 100vh;
}

/* Responsive: sidebar a comparsa sotto 992px */
@media (max-width: 991.98px) {
    .sg-sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sg-sidebar.show { transform: translateX(0); }
    .sg-topbar { left: 0; }
    .sg-main { margin-left: 0; }
}

/* ==========================================================
   Componenti
   ========================================================== */

/* Card riusabili */
.sg-card {
    background: var(--sg-bg-card);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius);
    box-shadow: var(--sg-shadow);
    margin-bottom: 18px;
}
.sg-card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sg-border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.sg-card-header i { color: var(--sg-blue); }
.sg-card-body { padding: 16px; }

/* KPI cards in dashboard */
.sg-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--sg-bg-card);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius);
    box-shadow: var(--sg-shadow);
    height: 100%;
}
.sg-kpi-icon {
    width: 48px; height: 48px;
    border-radius: var(--sg-radius);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.sg-kpi-icon.bg-navy { background: rgba(30,58,95,.10); color: var(--sg-navy); }
.sg-kpi-icon.bg-blue { background: rgba(13,110,253,.10); color: var(--sg-blue); }
.sg-kpi-icon.bg-success { background: rgba(25,135,84,.10); color: var(--sg-success); }
.sg-kpi-icon.bg-warning { background: rgba(245,159,0,.12); color: var(--sg-warning); }
.sg-kpi-icon.bg-danger { background: rgba(220,53,69,.10); color: var(--sg-danger); }
.sg-kpi-label { font-size: 12px; color: var(--sg-text-muted); text-transform: uppercase; letter-spacing: .5px; }
.sg-kpi-value { font-size: 22px; font-weight: 700; color: var(--sg-text); line-height: 1.1; }

/* Bottoni */
.btn-sg-primary {
    background: var(--sg-navy);
    border-color: var(--sg-navy);
    color: #fff;
}
.btn-sg-primary:hover, .btn-sg-primary:focus {
    background: var(--sg-navy-dark);
    border-color: var(--sg-navy-dark);
    color: #fff;
}

/* Toolbar di filtro / ricerca sopra le tabelle */
.sg-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.sg-toolbar .sg-toolbar-spacer { flex: 1; }
.sg-toolbar .input-group { width: auto; }

/* Badge di stato */
.sg-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    line-height: 1;
}
.sg-badge.active   { background: rgba(25,135,84,.12);  color: var(--sg-success); }
.sg-badge.warning  { background: rgba(245,159,0,.14);  color: #b56e00; }
.sg-badge.danger   { background: rgba(220,53,69,.12);  color: var(--sg-danger); }
.sg-badge.info     { background: rgba(13,202,240,.14); color: #0a7ea4; }
.sg-badge.neutral  { background: #eef0f4;              color: #5b6a7d; }

/* Tabelle */
.sg-table { width: 100%; background: var(--sg-bg-card); }
.sg-table thead th {
    background: #fafbfd;
    border-bottom: 1px solid var(--sg-border);
    color: var(--sg-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    padding: 10px 12px;
    white-space: nowrap;
}
.sg-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--sg-border);
    vertical-align: middle;
}
.sg-table tbody tr:hover { background: #fafbfd; }

/* Link "discreto" usato per i nomi cliccabili nelle tabelle:
   appare come testo normale, ma diventa blu+underline al hover */
.sg-row-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted transparent;
    transition: color .12s, border-color .12s;
}
.sg-row-link:hover {
    color: var(--sg-blue);
    border-bottom-color: var(--sg-blue);
    text-decoration: none;
}

/* Paginazione (sotto le tabelle) */
.sg-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 0 0;
    color: var(--sg-text-muted);
    font-size: 13px;
}

/* ==========================================================
   LOGIN
   ========================================================== */
.sg-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(135deg, rgba(22,41,63,.85) 0%, rgba(30,58,95,.70) 100%),
        url('../img/login-bg.jpg') center center / cover no-repeat;
    /* Se l'immagine non c'e', il gradiente sopra fa da sfondo */
}
.sg-login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
    padding: 32px 30px;
}
.sg-login-card .sg-login-logo {
    text-align: center;
    margin-bottom: 22px;
}
.sg-login-card .sg-login-logo .sg-logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px; height: 60px;
    border-radius: 14px;
    background: var(--sg-navy);
    color: #fff;
    font-size: 26px;
    margin-bottom: 10px;
}
.sg-login-card h1 {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    color: var(--sg-text);
    margin: 0 0 4px 0;
}
.sg-login-card .sg-login-sub {
    text-align: center;
    color: var(--sg-text-muted);
    font-size: 13px;
    margin-bottom: 22px;
}
.sg-login-card .form-label { font-weight: 500; font-size: 13px; }
.sg-login-card .form-control { padding: 10px 12px; }
.sg-login-card .btn-login {
    background: var(--sg-navy);
    color: #fff;
    width: 100%;
    padding: 10px;
    font-weight: 600;
    border: none;
}
.sg-login-card .btn-login:hover { background: var(--sg-navy-dark); }
.sg-login-foot {
    margin-top: 18px;
    text-align: center;
    color: var(--sg-text-muted);
    font-size: 12px;
}
.sg-login-error {
    background: rgba(220,53,69,.08);
    border: 1px solid rgba(220,53,69,.25);
    color: var(--sg-danger);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 14px;
}

/* ==========================================================
   AUTOCOMPLETE - usato nel modulo Contratti per cercare ditta
   ========================================================== */
.sg-autocomplete {
    position: relative;
}
.sg-autocomplete .form-control {
    font-size: 15px;
    padding: 12px 14px;
}
.sg-autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--sg-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    max-height: 360px;
    overflow-y: auto;
    z-index: 200;
    display: none;
    margin-top: 4px;
}
.sg-ac-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background .12s;
}
.sg-ac-item:last-child { border-bottom: none; }
.sg-ac-item:hover, .sg-ac-item.sg-ac-active {
    background: rgba(13, 110, 253, .06);
}
.sg-ac-item .sg-ac-idgis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 4px 8px;
    background: var(--sg-navy);
    color: #fff;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.sg-ac-item .sg-ac-info { flex: 1; min-width: 0; }
.sg-ac-item .sg-ac-name {
    font-weight: 600;
    color: var(--sg-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sg-ac-item .sg-ac-email {
    font-size: 11px;
    color: var(--sg-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sg-ac-empty {
    padding: 14px;
    color: var(--sg-text-muted);
    font-size: 13px;
    text-align: center;
}
.sg-ac-loading {
    padding: 10px;
    color: var(--sg-text-muted);
    font-size: 12px;
    text-align: center;
}

/* Ditta selezionata mostrata sotto la search (banner permanente) */
.sg-ditta-selected {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(30,58,95,.06) 0%, rgba(13,110,253,.04) 100%);
    border: 1px solid var(--sg-border);
    border-left: 4px solid var(--sg-blue);
    border-radius: 10px;
    margin-top: 14px;
}
.sg-ditta-selected .sg-idgis-big {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    padding: 10px 14px;
    background: var(--sg-navy);
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}
.sg-ditta-selected .sg-ds-rs {
    font-weight: 700;
    color: var(--sg-navy);
    font-size: 17px;
    line-height: 1.2;
}
.sg-ditta-selected .sg-ds-email {
    font-size: 12px;
    color: var(--sg-text-muted);
}
.sg-ds-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--sg-text-muted);
    margin-top: 4px;
}
.sg-ds-info-row .sg-ds-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.sg-ds-info-row .sg-ds-chip i { color: var(--sg-navy-light); }
.sg-ds-info-row .sg-ds-chip strong { color: var(--sg-text); font-weight: 600; }

/* ==========================================================
   CONTRATTI - tabella e badge specifici
   ========================================================== */
.sg-contratti-table th { font-size: 12px; }
.sg-contratti-table td { font-size: 13px; vertical-align: middle; }
.sg-contratti-table .sg-co-cell-meta {
    font-size: 11px;
    color: var(--sg-text-muted);
}
.sg-co-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-variant-numeric: tabular-nums;
}
.sg-co-date i { color: var(--sg-text-muted); }

/* Pillole giorni della settimana per "Giorno di riposo" multi-select */
.sg-day-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}
.sg-day-group .btn {
    min-width: 48px;
    font-weight: 600;
    border-radius: 8px !important;
}

/* Data fine prevista in stato di "scadenza": pillola colorata.
   Sfondo + testo + bordo + bold per renderla impossibile da ignorare. */
.sg-co-date.sg-co-scaduto,
.sg-co-date.sg-co-in-scadenza {
    padding: 3px 9px;
    border-radius: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    font-variant-numeric: tabular-nums;
}
.sg-co-date.sg-co-scaduto {
    background: rgba(220, 53, 69, .14);
    color: #b02a37;
    border-color: rgba(220, 53, 69, .35);
}
.sg-co-date.sg-co-scaduto i { color: #b02a37; }

.sg-co-date.sg-co-in-scadenza {
    background: rgba(245, 159, 0, .18);
    color: #a06400;
    border-color: rgba(245, 159, 0, .40);
}
.sg-co-date.sg-co-in-scadenza i { color: #a06400; }

/* ==========================================================
   MATRICE PAGHE - tabella Ditta x 12 mesi con celle cliccabili
   Ogni cella ha uno stato visivo (ok/presenze/buste/chiusa/sospesa/todo)
   e puo' mostrare un pallino se ci sono note mensili.
   ========================================================== */
.sg-paghe-matrix {
    margin-bottom: 0;
}
.sg-paghe-matrix th,
.sg-paghe-matrix td {
    vertical-align: middle;
    padding: 6px 4px;
    text-align: center;
    white-space: nowrap;
    font-size: 12px;
}
.sg-paghe-matrix th.sg-anag,
.sg-paghe-matrix td.sg-anag {
    text-align: left;
    padding: 8px 12px;
    font-size: 13px;
}
.sg-paghe-matrix th.sg-month {
    font-weight: 700;
    color: var(--sg-navy);
    width: 42px;
}
.sg-paghe-matrix th.sg-month.sg-month-current {
    color: var(--sg-blue);
    background: rgba(13, 110, 253, .06);
    border-radius: 4px;
}
.sg-paghe-matrix .sg-mese-mini {
    font-size: 10px;
    color: var(--sg-text-muted);
    display: block;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.sg-paghe-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: #eef0f4;
    color: #b3bcc7;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    transition: transform .12s, box-shadow .12s;
    line-height: 1;
}
.sg-paghe-cell:hover {
    transform: scale(1.10);
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    z-index: 2;
}
.sg-paghe-cell.sg-mese-ok {
    background: rgba(25,135,84,.18);
    color: #146c43;
    border-color: rgba(25,135,84,.30);
}
.sg-paghe-cell.sg-mese-presenze {
    background: rgba(245,159,0,.18);
    color: #a06400;
    border-color: rgba(245,159,0,.30);
}
.sg-paghe-cell.sg-mese-buste {
    background: rgba(13,202,240,.18);
    color: #0a7ea4;
    border-color: rgba(13,202,240,.30);
}
.sg-paghe-cell.sg-mese-chiusa {
    background: #3a3f4a;
    color: #d3d8e0;
    border-color: #2a2e36;
}
.sg-paghe-cell.sg-mese-sospesa {
    background: rgba(220,53,69,.14);
    color: #b02a37;
    border-color: rgba(220,53,69,.32);
}
.sg-paghe-cell.sg-mese-todo {
    background: #f0f2f5;
    color: #b3bcc7;
}
/* indicatore "ha note" (pallino arancione in alto a destra) */
.sg-paghe-cell.has-note::after {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f59f00;
    box-shadow: 0 0 0 1px #fff;
}

/* Badge d'angolo per lo stato della busta paga (basso-sinistra) */
.sg-busta-badge {
    position: absolute;
    bottom: -4px;
    left: -4px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    line-height: 1;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,.18);
}
.sg-busta-badge.sg-busta-bozza { color: #a06400; }      /* matita: in lavorazione */
.sg-busta-badge.sg-busta-approvato { color: #146c43; }  /* approvato */

/* Legenda colori sopra la matrice */
.sg-paghe-legenda {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12px;
    color: var(--sg-text-muted);
}
.sg-paghe-legenda .sg-leg-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sg-paghe-legenda .sg-paghe-cell {
    width: 20px;
    height: 20px;
    cursor: default;
    font-size: 11px;
}
.sg-paghe-legenda .sg-paghe-cell:hover {
    transform: none;
    box-shadow: none;
}

/* La colonna "Ditta" si distingue */
.sg-paghe-matrix .sg-ditta-info { font-weight: 600; color: var(--sg-text); }
.sg-paghe-matrix .sg-ditta-meta { font-size: 11px; color: var(--sg-text-muted); }

/* Header del modal Paghe: riga in formato copia/incolla per email
   "{IDGis} - {RAGIONE SOCIALE} - Presenze {Mese} {Anno}"
   Layout: icona navy + testo monospace selezionabile + bottone copia. */
.sg-mp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(30,58,95,.05) 0%, rgba(13,110,253,.04) 100%);
    border: 1px solid var(--sg-border);
    border-left: 3px solid var(--sg-blue);
    border-radius: 10px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
.sg-mp-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--sg-navy);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(30,58,95,.20);
}
.sg-mp-text {
    flex: 1;
    font-family: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 14px;
    color: var(--sg-navy);
    font-weight: 600;
    letter-spacing: .2px;
    word-break: break-word;
    line-height: 1.35;
    user-select: all;
    -webkit-user-select: all;
    cursor: text;
}
.sg-mp-copy {
    flex-shrink: 0;
    border: 1px solid var(--sg-border);
    background: #ffffff;
    color: var(--sg-text-muted);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .12s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    white-space: nowrap;
}
.sg-mp-copy:hover {
    background: var(--sg-blue);
    color: #fff;
    border-color: var(--sg-blue);
    transform: translateY(-1px);
}
.sg-mp-copy.copied {
    background: var(--sg-success);
    color: #fff;
    border-color: var(--sg-success);
    transform: none;
}

/* ID Gis: numero in evidenza */
.sg-paghe-matrix .sg-idgis-col {
    text-align: center;
    padding: 6px 10px;
    min-width: 78px;
}
.sg-idgis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 6px 10px;
    background: var(--sg-navy);
    color: #fff;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .5px;
    font-variant-numeric: tabular-nums;
}

/* Card "Ditta" nella scheda dipendente: ID GIS grande + rag. soc. */
.sg-dip-ditta {
    text-align: center;
}
.sg-dip-ditta .sg-idgis-big {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 14px 22px;
    background: var(--sg-navy);
    color: #fff;
    border-radius: 12px;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: .8px;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 4px 10px rgba(30, 58, 95, .25);
    margin-bottom: 10px;
}
.sg-dip-ditta .sg-dip-ragsoc {
    font-weight: 600;
    color: var(--sg-text);
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 2px;
}
.sg-dip-ditta .sg-dip-rs-email {
    font-size: 12px;
    color: var(--sg-text-muted);
}
.sg-dip-ditta .sg-dip-rs-missing {
    color: var(--sg-warning);
    font-size: 12px;
    font-style: italic;
}

/* ==========================================================
   LANGUAGE TABS - tab di selezione lingua per i campi multilingua
   Usate nella scheda Mod_Attivita per Nome/Descrizione in 4 lingue.
   ========================================================== */
.sg-lang-tabs.nav-tabs {
    border-bottom: 1px solid var(--sg-border);
    margin-bottom: 18px;
}
.sg-lang-tabs .nav-link {
    color: var(--sg-text-muted);
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 10px 16px;
    font-weight: 500;
    font-size: 13px;
    margin-bottom: -1px;
}
.sg-lang-tabs .nav-link:hover {
    color: var(--sg-navy);
    background: #fafbfd;
    border-bottom-color: rgba(13, 110, 253, .25);
}
.sg-lang-tabs .nav-link.active {
    color: var(--sg-navy);
    background: transparent;
    border-bottom-color: var(--sg-blue);
    font-weight: 600;
}
.sg-lang-tabcontent {
    padding-top: 6px;
}

/* ==========================================================
   SERVICE PILLS - icone tonde per servizi attivi/disattivi
   Usate nell'elenco utenti per mostrare a colpo d'occhio
   contabilita, emissione fatt, archivia fatt, PEC, paghe.
   ========================================================== */
.sg-service-pills {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    flex-wrap: nowrap;
}
.sg-service-pill {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
    border: 1px solid transparent;
    transition: transform .12s ease, box-shadow .12s ease;
    cursor: default;
}
.sg-service-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,.10);
}
.sg-service-pill.sg-on {
    background: rgba(25, 135, 84, .14);
    color: var(--sg-success);
    border-color: rgba(25,135,84,.20);
}
.sg-service-pill.sg-off {
    background: #eef0f4;
    color: #b3bcc7;
    border-color: #e3e6ec;
}

/* ----------------------------------------------------------
   SERVICE CARDS - card grande con icona, nome, switch iOS
   Usate nella scheda Mod_Utenti per attivare/disattivare
   i 5 servizi (contabilita, emissione, archivio, PEC, paghe).
   ---------------------------------------------------------- */
.sg-service-card {
    background: #ffffff;
    border: 1.5px solid var(--sg-border);
    border-radius: 14px;
    padding: 18px 14px;
    text-align: center;
    transition: background .2s, border-color .2s, box-shadow .2s;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.sg-service-card.is-active {
    background: linear-gradient(180deg, #eff5ff 0%, #ffffff 100%);
    border-color: rgba(13, 110, 253, .35);
    box-shadow: 0 4px 14px rgba(13, 110, 253, .08);
}
.sg-service-card-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.sg-service-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: #eef0f4;
    color: #95a0ad;
    transition: background .25s, color .25s;
}
.sg-service-card.is-active .sg-service-card-icon {
    background: rgba(13, 110, 253, .14);
    color: var(--sg-blue);
}
.sg-service-card-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--sg-text);
    line-height: 1.2;
}
.sg-service-card-status {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--sg-text-muted);
    font-weight: 600;
}
.sg-service-card.is-active .sg-service-card-status {
    color: var(--sg-blue);
}

/* ----------------------------------------------------------
   SWITCH ROW - switch riusabile in qualunque sezione
   (es. Newsletter, Privacy, ecc.) senza la wrapper card.
   ---------------------------------------------------------- */
.sg-switch-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #fafbfd;
    border: 1px solid var(--sg-border);
    border-radius: 10px;
}
.sg-switch-row .sg-bigswitch {
    flex-shrink: 0;
}
.sg-switch-row > div { line-height: 1.3; }

/* Big iOS-style switch (label-wrapped) */
.sg-bigswitch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}
.sg-bigswitch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.sg-bigswitch-slider {
    position: absolute;
    inset: 0;
    background: #cdd3da;
    border-radius: 30px;
    transition: background .25s;
}
.sg-bigswitch-slider::before {
    content: "";
    position: absolute;
    height: 24px;
    width: 24px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform .25s;
    box-shadow: 0 2px 4px rgba(0,0,0,.22);
}
.sg-bigswitch input:checked + .sg-bigswitch-slider {
    background: var(--sg-blue);
}
.sg-bigswitch input:checked + .sg-bigswitch-slider::before {
    transform: translateX(26px);
}
.sg-bigswitch input:focus-visible + .sg-bigswitch-slider {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, .25);
}

/* ==========================================================
   CAMPANELLA SCADENZE (topbar)
   ========================================================== */
.sg-bell {
    position: relative;
    margin-right: 12px;
}
.sg-bell-btn {
    background: transparent;
    border: 1px solid var(--sg-border);
    color: var(--sg-navy);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    position: relative;
}
.sg-bell-btn:hover { background: #f5f7fa; border-color: var(--sg-blue); color: var(--sg-blue); }
.sg-bell-btn.has-items { color: var(--sg-warning); border-color: rgba(245,159,0,.45); }
.sg-bell-btn.has-urgent { color: var(--sg-danger); border-color: rgba(220,53,69,.50); }
.sg-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--sg-danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    padding: 0 5px;
    box-shadow: 0 0 0 2px #fff;
}
.sg-bell-dropdown {
    position: absolute;
    top: 46px;
    right: 0;
    width: 380px;
    max-width: 90vw;
    background: #fff;
    border: 1px solid var(--sg-border);
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(0,0,0,.18);
    z-index: 1050;
    display: none;
    overflow: hidden;
}
.sg-bell-dropdown.show { display: block; }
.sg-bell-dropdown .sg-bell-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sg-border);
    font-weight: 600;
    background: linear-gradient(135deg, rgba(30,58,95,.04), rgba(13,110,253,.04));
    display: flex;
    align-items: center;
    gap: 8px;
}
.sg-bell-dropdown .sg-bell-body {
    max-height: 420px;
    overflow-y: auto;
}
.sg-bell-item {
    display: flex;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
    gap: 10px;
    transition: background .12s;
    align-items: flex-start;
}
.sg-bell-item:hover { background: #fafbfd; }
.sg-bell-item:last-child { border-bottom: none; }
.sg-bell-item .sg-bell-icon {
    width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 14px;
}
.sg-bell-item.sg-urg-scaduto  .sg-bell-icon { background: rgba(220,53,69,.15);  color: #b02a37; }
.sg-bell-item.sg-urg-oggi     .sg-bell-icon { background: rgba(245,159,0,.18);  color: #a06400; }
.sg-bell-item.sg-urg-prossima .sg-bell-icon { background: rgba(13,202,240,.18); color: #0a7ea4; }
.sg-bell-item.sg-urg-futura   .sg-bell-icon { background: #eef0f4; color: #5b6a7d; }

.sg-bell-info { flex: 1; min-width: 0; }
.sg-bell-info .sg-bell-dip { font-weight: 600; font-size: 13px; color: var(--sg-text); }
.sg-bell-info .sg-bell-meta { font-size: 11px; color: var(--sg-text-muted); margin-top: 2px; }
.sg-bell-info .sg-bell-descr { font-size: 12px; color: var(--sg-text); margin-top: 3px; }
.sg-bell-when { font-size: 11px; font-weight: 700; white-space: nowrap; }
.sg-bell-when.scaduto  { color: #b02a37; }
.sg-bell-when.oggi     { color: #a06400; }
.sg-bell-when.prossima { color: #0a7ea4; }
.sg-bell-when.futura   { color: var(--sg-text-muted); }

.sg-bell-empty { padding: 24px 16px; text-align: center; color: var(--sg-text-muted); font-size: 13px; }
.sg-bell-empty i { font-size: 28px; display: block; margin-bottom: 8px; color: var(--sg-success); }

.sg-bell-foot {
    padding: 10px 16px;
    border-top: 1px solid var(--sg-border);
    text-align: center;
    background: #fafbfd;
}
.sg-bell-foot a { font-size: 13px; font-weight: 600; }

/* ==========================================================
   LOADER full-screen (su submit / postback)
   ========================================================== */
.sg-loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(22, 41, 63, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    /* fade-in dolce */
    opacity: 0;
    transition: opacity .15s ease;
}
.sg-loader.show {
    display: flex;
    opacity: 1;
}
.sg-loader-inner {
    background: #ffffff;
    border-radius: 12px;
    padding: 22px 28px;
    box-shadow: 0 14px 44px rgba(0,0,0,.28);
    text-align: center;
    min-width: 200px;
}
.sg-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #e3e6ec;
    border-top-color: var(--sg-navy);
    border-radius: 50%;
    animation: sg-spin 0.75s linear infinite;
    margin: 0 auto 10px auto;
}
.sg-loader-text {
    color: var(--sg-navy);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.2px;
}
@keyframes sg-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================
   Flatpickr - piccoli accorgimenti grafici
   ========================================================== */
.flatpickr-input { background: #fff; }
.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after { border-bottom-color: var(--sg-navy) !important; }
.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-weekdays { background: var(--sg-navy) !important; color: #fff !important; }
.flatpickr-day.selected { background: var(--sg-blue); border-color: var(--sg-blue); }

/* ==========================================================
   Colonna "Azioni" nell'elenco utenti
   Su desktop ha larghezza FISSA per evitare che i bottoni vadano
   a capo. Su mobile/tablet la lasciamo libera (la tabella ha gia'
   table-responsive che gestisce lo scroll orizzontale).
   ========================================================== */
@media (min-width: 992px) {
    .sg-table th.sg-col-azioni-utenti,
    .sg-table td.sg-col-azioni-utenti {
        width: 170px;
        min-width: 170px;
        white-space: nowrap;
    }
}

/* ==========================================================
   Dropzone allegati email (modal "Componi email")
   ========================================================== */
.sg-dropzone {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 18px 16px;
    text-align: center;
    background: #fafbfd;
    transition: all .15s ease;
    cursor: pointer;
}
.sg-dropzone.is-drag {
    border-color: var(--sg-blue);
    background: #e7f1ff;
}
.sg-dropzone .sg-dz-icon {
    font-size: 28px;
    color: var(--sg-text-muted);
    line-height: 1;
    margin-bottom: 4px;
}
.sg-dropzone .sg-dz-text {
    font-size: 13px;
    color: var(--sg-text);
}
.sg-dropzone .sg-dz-text a {
    color: var(--sg-blue);
    text-decoration: underline;
    font-weight: 600;
}
.sg-dropzone .sg-dz-hint {
    margin-top: 2px;
}
.sg-allegato-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--sg-border);
    border-radius: 6px;
    background: #fff;
    margin-top: 6px;
    font-size: 12.5px;
}
.sg-allegato-item .sg-al-icon {
    color: var(--sg-navy);
    font-size: 16px;
    flex-shrink: 0;
}
.sg-allegato-item .sg-al-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sg-allegato-item .sg-al-size {
    color: var(--sg-text-muted);
    font-size: 11px;
    flex-shrink: 0;
}
.sg-allegato-item .sg-al-state {
    flex-shrink: 0;
}
.sg-allegato-item .sg-al-remove {
    background: transparent;
    border: 0;
    color: var(--sg-danger);
    padding: 2px 6px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ==========================================================
   Picker mese per "Stampa elenco paghe"
   ========================================================== */
.sg-stampa-mesi .sg-stampa-mese-btn {
    min-width: 56px;
    padding: 6px 10px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .03em;
}
.sg-stampa-mesi .sg-stampa-mese-btn.active {
    background: var(--sg-navy);
    color: #fff;
    border-color: var(--sg-navy);
}

/* ==========================================================
   Scheda 360 - Avatar grande nel banner cliente
   ========================================================== */
.sg-avatar-xl {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sg-navy), var(--sg-navy-light));
    color: #fff;
    font-weight: 700;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(30, 58, 95, 0.25);
}

/* ==========================================================
   Modulo SERVIZI ANNUALI
   Matrice ditte x servizi: piccoli accorgimenti grafici
   ========================================================== */
.sg-servizi-matrix th.sg-srv-col {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--sg-text-muted);
    background: #f5f7fb;
    white-space: nowrap;
    /* Larghezza minima per non comprimere l'importo nelle celle */
    min-width: 120px;
}
.sg-servizi-matrix td.sg-srv-on,
.sg-servizi-matrix td.sg-srv-off {
    min-width: 120px;
}
.sg-servizi-matrix td.sg-srv-on {
    background: #e8f5ee;
}
.sg-servizi-matrix td.sg-srv-on .small {
    font-size: 11px;
    font-weight: 600;
    color: #198754;
    white-space: nowrap;
}
.sg-servizi-matrix td.sg-srv-off {
    background: #fafbfc;
}
.sg-servizi-matrix tbody tr:hover td.sg-srv-on { background: #d8efde; }

/* Riga servizio nella scheda Mod_Servizi: evidenza riga "attiva" */
.sg-srv-row {
    transition: background .15s ease;
}
.sg-srv-row:not(.is-active) {
    color: var(--sg-text-muted);
}
.sg-srv-row:not(.is-active) input.sg-srv-price {
    background: #f5f7fb;
}
.sg-srv-row.is-active {
    background: #f1f9f4;
}

/* ==========================================================
   ACTION BAR fissa in fondo (CTA sempre visibili)
   Le pagine marcano il contenitore dei pulsanti finali con
   class="sg-actionbar". site.js aggiunge 'sg-has-actionbar'
   al <body> per dare al contenuto il padding inferiore e non
   farlo finire sotto la barra.
   ========================================================== */
.sg-actionbar {
    position: fixed;
    left: var(--sg-sidebar-w);
    right: 0;
    bottom: 0;
    z-index: 1035;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    margin: 0 !important;
    padding: .6rem 1.25rem;
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .07);
}
@media (max-width: 991.98px) {
    .sg-actionbar { left: 0; }
}
/* Spazio in fondo al contenuto quando c'e' la barra fissa */
.sg-has-actionbar .sg-main {
    padding-bottom: 92px;
}
