


:root {
    --os-blue: #005baa;
    --os-blue-dark: #004984;
    --os-blue-light: #eaf3fb;
    --os-text: #333333;
    --os-muted: #6c757d;
    --os-border: #e5e9ee;
    --os-background: #f5f7fa;
    --header-height: 74px;
}

html {
    font-size: 15px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--os-text);
    background: var(--os-background);
    display: flex;
    flex-direction: column;
}


/* =========================================================
           HEADER
   ========================================================= */

.os-header {
    height: var(--header-height);
    background: #ffffff;
    border-bottom: 1px solid var(--os-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}

.os-header-inner {
    height: 100%;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}


/* =========================================================
           LOGO
           ========================================================= */

.os-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    height: 100%;
}

.os-logo {
    height: 58px;
    width: auto;
    object-fit: contain;
}

.os-module {
    margin-left: 18px;
    padding-left: 18px;
    border-left: 1px solid #dfe4e8;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--os-blue);
    font-size: 16px;
    font-weight: 600;
}

    .os-module i {
        font-size: 19px;
    }


/* =========================================================
           NAVIGATION
           ========================================================= */

.os-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.os-nav-link {
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-radius: 5px;
    color: #4b5563;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.os-nav-dropdown {
    display: flex;
    align-items: center;
    height: 100%;
}

.os-nav-dropdown-toggle {
    border: 0;
    background: transparent;
    appearance: none;
    cursor: pointer;
}

    .os-nav-dropdown-toggle.dropdown-toggle::after {
        margin-left: 7px;
    }

    .os-nav-link i {
        margin-right: 7px;
        font-size: 16px;
    }

    .os-nav-link:hover {
        color: var(--os-blue);
        background: var(--os-blue-light);
    }

    .os-nav-link.active {
        color: var(--os-blue);
        background: var(--os-blue-light);
        font-weight: 600;
    }

    .os-nav-dropdown-toggle.active {
        color: var(--os-blue);
        background: var(--os-blue-light);
        font-weight: 600;
    }


/* =========================================================
           USER AREA
           ========================================================= */

.os-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 18px;
    padding-left: 18px;
    border-left: 1px solid var(--os-border);
}

.os-notification-bell {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--os-blue);
    background: var(--os-blue-light);
    text-decoration: none;
    transition: transform .15s ease, background-color .15s ease;
}

    .os-notification-bell:hover {
        color: var(--os-blue-dark);
        background: #dcecf9;
        transform: translateY(-1px);
    }

    .os-notification-bell i {
        font-size: 18px;
    }

.os-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dc3545;
    color: #fff;
    border: 2px solid #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.os-signalr-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #6c757d;
}

/* Timesheet: badge assenze con font uguale alle commesse */
#timesheetTable .badge.bg-info {
    font-size: inherit;
    font-weight: 400;
}

.os-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--os-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.os-user-info {
    line-height: 1.2;
}

.os-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.os-user-role {
    font-size: 11px;
    color: #89919a;
    margin-top: 2px;
}


/* =========================================================
           BANNER COMUNICAZIONI (Super Amministratore)
           ========================================================= */

/* Barre impilate fra header e contenuto: una per ogni comunicazione BANNER
   attiva. Il contenuto è solo data + testo; la X compare solo quando chi
   guarda può segnarla letta/chiuderla (canDismiss deciso dal server). */
.os-banner-container {
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: linear-gradient(135deg, #2c3240, #141820);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
}

.os-banner-container:empty {
    display: none;
}

.os-banner {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: .6rem 32px;
    font-size: .95rem;
    color: #fff;
}

/* Fascio di luce che attraversa periodicamente il banner (vedi
   docs/mockup/banner-luce.html). Sullo sfondo chiaro il bagliore e' bianco
   semi-trasparente; pointer-events none per non intercettare la X. */
.os-banner::after {
    content: '';
    position: absolute;
    top: -40%;
    bottom: -40%;
    left: -30%;
    width: 18%;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255, 255, 255, .25) 40%,
        rgba(255, 255, 255, .6) 50%,
        rgba(255, 255, 255, .25) 60%,
        transparent 100%
    );
    transform: skewX(-20deg);
    animation: os-banner-sweep 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes os-banner-sweep {
    0%        { left: -30%; }
    60%, 100% { left: 130%; }
}

.os-banner + .os-banner {
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.os-banner-icon {
    color: #8ab8f0;
    font-size: 1.05rem;
    line-height: 1.4;
}

.os-banner-body {
    flex: 1;
    min-width: 0;
}

.os-banner-date {
    color: #8ab8f0;
    font-weight: 600;
    margin-right: .5rem;
    white-space: nowrap;
}

.os-banner-dismiss {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .6);
    padding: .1rem .35rem;
    line-height: 1.4;
}

.os-banner-dismiss:hover {
    color: #fff;
}


/* =========================================================
           MAIN
           ========================================================= */

.os-main {
    flex: 1;
    padding: 0px 32px 10px;
}

.os-content {
    max-width: 1600px;
    margin: 0 auto;
}


/* =========================================================
           PAGE HEADER
           ========================================================= */

.page-header {
    margin-bottom: 24px;
}

.page-title {
    margin: 0;
    color: #263746;
    font-size: 25px;
    font-weight: 600;
}

.page-subtitle {
    margin-top: 5px;
    color: var(--os-muted);
    font-size: 14px;
}


/* =========================================================
           CARDS
           ========================================================= */

.os-card {
    background: #ffffff;
    border: 1px solid var(--os-border);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .025);
}

.os-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--os-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.os-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #263746;
}

.os-card-body {
    padding: 20px;
}


/* =========================================================
           BUTTONS
           ========================================================= */

.btn-os-primary {
    background: var(--os-blue);
    border-color: var(--os-blue);
    color: #ffffff;
    font-weight: 500;
}

    .btn-os-primary:hover {
        background: var(--os-blue-dark);
        border-color: var(--os-blue-dark);
        color: #ffffff;
    }


/* =========================================================
           FOOTER
           ========================================================= */

.os-footer {
    background: #ffffff;
    border-top: 1px solid var(--os-border);
    color: #707981;
    font-size: 12px;
}

.os-footer-main {
    padding: 10px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.os-footer-company {
    color: #4c555d;
    font-weight: 600;
}

.os-footer-address {
    margin-top: 3px;
    font-weight: 400;
    color: #8a9299;
}

.os-footer-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

    .os-footer-links a {
        color: #707981;
        text-decoration: none;
    }

        .os-footer-links a:hover {
            color: var(--os-blue);
        }

.os-footer-bottom {
    padding: 9px 32px;
    background: #f8f9fa;
    border-top: 1px solid #edf0f2;
    display: flex;
    justify-content: space-between;
    color: #9299a0;
    font-size: 11px;
}


/* =========================================================
           RESPONSIVE
           ========================================================= */

@media (max-width: 1100px) {

    .os-nav-link {
        padding: 0 10px;
    }

        .os-nav-link span {
            display: none;
        }

    .os-user-info {
        display: none;
    }
}

@media (max-width: 768px) {

    :root {
        --header-height: 64px;
    }

    .os-header-inner {
        padding: 0 16px;
    }

    .os-logo {
        height: 46px;
    }

    .os-module {
        margin-left: 10px;
        padding-left: 10px;
    }

        .os-module span {
            display: none;
        }

    .os-nav {
        display: none;
    }

    .os-main {
        padding: 0px 16px 10px;
    }

    .os-footer-main {
        padding: 10px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .os-footer-bottom {
        padding: 9px 16px;
    }
}

/* Il contenitore del DataTable deve clippare le etichette che escono a destra. */
.dataTables_wrapper,
.table-responsive {
    overflow-x: hidden;
}

/* Pulsanti azione compatti: icona sempre visibile, etichetta espandibile su hover/focus.
   Usati in DataTables, modali, toolbar e liste azione.
   L'etichetta è in posizione assoluta, attaccata al pulsante, stessa altezza e stile,
   in modo che sembri il pulsante che si allarga. Non causa layout shift. */

/* Andata a capo nelle celle DataTable (testo lungo) */
.dt-wrap {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal !important;
}

/* Cella DataTable con testo troncato ed ellipsis (no andata a capo) */
.dt-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

/* Pulsanti azione nei DataTable: icona sola, tooltip nativo dal testo di
   .dt-action-label (popolato in JS in site.js). La label resta nel DOM ma
   non e' mai visibile: serve solo come sorgente del tooltip. */
.dt-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    vertical-align: middle;
    min-width: 2rem;
    min-height: 28px;
}

.dt-action-label {
    display: none;
}

/* Footer dei modali e barre azioni in fondo alla pagina: pulsanti sempre con le stesse dimensioni in tutte le view. */
.modal-footer .btn,
.form-actions .btn {
    min-width: 7.5rem;
    min-height: 2.5rem;
    padding: .375rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    font-size: .95rem;
    line-height: 1.5;
    white-space: nowrap;
}
