.brand-title {
    letter-spacing: 0.2px;
    font-size: 1rem;
    line-height: 1.1;
    white-space: nowrap;
}

.nav-header .brand-logo {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 14px;
    background: #ffffff;
    overflow: hidden;
}

.app-logo-header {
    display: block;
    height: 36px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

#main-wrapper.menu-toggle .nav-header .brand-logo {
    justify-content: center;
    padding-left: 0;
}

#main-wrapper.menu-toggle .app-logo-header {
    height: 30px;
    max-width: 34px;
}

.app-logo-fallback {
    display: none;
}

.app-logo-auth {
    display: inline-block;
    width: min(300px, 80%);
    height: auto;
    object-fit: contain;
}

.header-user-name {
    color: var(--bs-heading-color);
}

/* Header readability fixes */
#main-wrapper .nav-header {
    background: #ffffff;
    border-right: 1px solid #e8e8e8;
}

#main-wrapper .header {
    background: #ffffff;
}

#main-wrapper .header .header-content {
    background: #ffffff;
}

#main-wrapper .header .header-content h4 {
    color: #111111 !important;
}

#main-wrapper .header .header-content .navbar {
    background: #ffffff;
}

#main-wrapper .nav-control .hamburger .line {
    background: #4a4a4a;
}

#main-wrapper .content-body .page-title .breadcrumb-item.active {
    color: #4f4f4f;
    font-weight: 500;
}

.deznav .metismenu > li > a .menu-icon svg {
    width: 20px;
    height: 20px;
}

.deznav .metismenu > li.mm-active > a .menu-icon svg path,
.deznav .metismenu > li:hover > a .menu-icon svg path {
    stroke: var(--bs-primary);
}

.role-modules .list-group-item {
    border-left: 0;
    border-right: 0;
    padding-left: 0;
    padding-right: 0;
}

.role-modules .badge {
    min-width: 42px;
    text-align: center;
}

.dataTables_wrapper .dataTables_filter input {
    margin-left: 0.4rem;
}

.ticket-detail-layout .card .card-header {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.ticket-detail-layout .card .card-body {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.ticket-detail-layout .card {
    margin-bottom: 0.85rem;
    height: auto !important;
}

.ticket-detail-layout .card-title {
    font-size: 0.98rem;
    line-height: 1.25;
    margin-bottom: 0;
}

.ticket-detail-layout .card .form-label {
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
}

.ticket-detail-layout .card .mb-3 {
    margin-bottom: 0.55rem !important;
}

.ticket-detail-layout .card .btn {
    padding: 0.38rem 0.7rem;
    font-size: 0.82rem;
}

.ticket-detail-layout .card p {
    margin-bottom: 0.45rem;
}

.ticket-detail-layout .card .card-body {
    flex: 0 0 auto;
}

.ticket-scroll-list {
    max-height: 130px;
    overflow-y: auto;
    padding-right: 0.35rem;
}

.ticket-scroll-list.ticket-scroll-list--timeline {
    max-height: 320px;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}

.ticket-scroll-list.ticket-scroll-list--timeline .list-group-item {
    border: 1px solid #e4e9f2;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    padding: 0.55rem 0.65rem;
    background: #ffffff;
}

.ticket-scroll-list.ticket-scroll-list--timeline .list-group-item:last-child {
    margin-bottom: 0;
}

.ticket-open-btn {
    display: block;
    width: 100%;
    text-align: center;
    white-space: nowrap;
}

#main-wrapper.app-role-operatore {
    background: #f3f6fb;
}

#main-wrapper.app-role-operatore .nav-header,
#main-wrapper.app-role-operatore .deznav {
    display: none;
}

#main-wrapper.app-role-operatore .header {
    left: 0 !important;
    width: 100% !important;
}

#main-wrapper.app-role-operatore .content-body {
    margin-left: 0 !important;
    min-height: 100vh;
    padding-top: 0 !important;
}

#main-wrapper.app-role-operatore .operator-mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem calc(0.55rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid #e2e8f0;
    backdrop-filter: blur(6px);
}

#main-wrapper.app-role-operatore .operator-mobile-tabbar__item {
    flex: 1 1 0;
    min-height: 48px;
    border-radius: 12px;
    border: 1px solid #dce5f1;
    color: #435061;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-size: 0.83rem;
    font-weight: 600;
    background: #f8fbff;
    text-align: center;
}

#main-wrapper.app-role-operatore .operator-mobile-tabbar__item.is-active {
    border-color: #0d6efd;
    color: #0d6efd;
    background: #eef5ff;
}

#main-wrapper.app-role-operatore .operator-mobile-tabbar__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.08);
}

#main-wrapper.app-role-operatore .operator-mobile-tabbar__icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

#main-wrapper.app-role-operatore .operator-mobile-tabbar-spacer {
    height: calc(64px + env(safe-area-inset-bottom));
}

#main-wrapper.app-role-operatore #operator-status-card,
#main-wrapper.app-role-operatore #operator-appointment-card,
#main-wrapper.app-role-operatore #operator-note-card {
    scroll-margin-top: 5.4rem;
}

@media (max-width: 991px) {
    .brand-title {
        font-size: 0.92rem;
    }

    .app-logo-header {
        height: 28px;
        max-width: 100%;
    }

    #main-wrapper.menu-toggle .app-logo-header {
        height: 26px;
        max-width: 30px;
    }

    .header-content .container-fluid {
        gap: 0.75rem;
    }

    .header-content .btn {
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 1023px) {
    .nav-header .brand-logo {
        padding-left: 0;
        padding-right: 0;
        justify-content: center;
    }

    .app-logo-header {
        height: 24px;
        max-width: calc(100% - 10px);
    }
}

@media (max-width: 767px) {
    .app-logo-header {
        height: 22px;
        max-width: calc(100% - 8px);
    }
}

/* Mobile optimization dedicated to OPERATORE role */
@media (max-width: 991px) {
    #main-wrapper.app-role-operatore .header {
        position: sticky;
        top: 0;
        z-index: 1032;
        box-shadow: 0 1px 10px rgba(13, 37, 76, 0.08);
    }

    #main-wrapper.app-role-operatore .content-body .container-fluid {
        padding-left: 0.7rem;
        padding-right: 0.7rem;
    }

    #main-wrapper.app-role-operatore .page-title h1 {
        font-size: 1.05rem;
        margin-bottom: 0.15rem;
    }

    #main-wrapper.app-role-operatore .page-title .breadcrumb-item.active {
        font-size: 0.78rem;
    }

    #main-wrapper.app-role-operatore .header-user-name {
        max-width: 135px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #main-wrapper.app-role-operatore .header-content .btn {
        margin-top: 0.25rem;
    }

    #main-wrapper.app-role-operatore .card .card-header {
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
    }

    #main-wrapper.app-role-operatore .card .card-title {
        font-size: 0.95rem;
    }

    #main-wrapper.app-role-operatore .card {
        border: 0;
        border-radius: 14px;
        box-shadow: 0 8px 24px rgba(24, 39, 75, 0.08);
    }

    #main-wrapper.app-role-operatore .btn {
        min-height: 42px;
        border-radius: 10px;
    }

    #main-wrapper.app-role-operatore .ticket-detail-layout .card .btn,
    #main-wrapper.app-role-operatore .ticket-detail-layout .card .form-control,
    #main-wrapper.app-role-operatore .ticket-detail-layout .card .form-select {
        font-size: 0.94rem;
    }

    #main-wrapper.app-role-operatore .ticket-detail-layout .col-xl-5 .btn {
        width: 100%;
    }

    #main-wrapper.app-role-operatore .ticket-scroll-list {
        max-height: 210px;
    }

    #main-wrapper.app-role-operatore .dataTables_wrapper .dataTables_filter,
    #main-wrapper.app-role-operatore .dataTables_wrapper .dataTables_info,
    #main-wrapper.app-role-operatore .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: left;
        margin-top: 0.45rem;
    }

    #main-wrapper.app-role-operatore .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin-left: 0;
        margin-top: 0.35rem;
    }

    #main-wrapper.app-role-operatore .operator-mobile-table thead {
        display: none;
    }

    #main-wrapper.app-role-operatore .operator-mobile-table tbody tr {
        display: block;
        border: 1px solid #e7e7e7;
        border-radius: 10px;
        padding: 0.4rem 0.55rem;
        margin-bottom: 0.65rem;
        background: #fff;
    }

    #main-wrapper.app-role-operatore .operator-mobile-table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.65rem;
        width: 100%;
        border: 0;
        padding: 0.38rem 0;
        font-size: 0.86rem;
    }

    #main-wrapper.app-role-operatore .operator-mobile-table tbody td::before {
        content: attr(data-label);
        color: #6c757d;
        font-weight: 600;
        flex: 0 0 42%;
        max-width: 42%;
    }

    #main-wrapper.app-role-operatore .operator-mobile-table tbody td .badge {
        white-space: nowrap;
    }

    #main-wrapper.app-role-operatore .operator-mobile-table .ticket-open-btn {
        width: 100%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    #main-wrapper.app-role-operatore .operator-mobile-table tbody td.ticket-action-cell {
        display: block;
    }

    #main-wrapper.app-role-operatore .operator-mobile-table tbody td.ticket-action-cell::before {
        display: none;
    }

    #main-wrapper.app-role-operatore .ticket-detail-layout--operator {
        padding-bottom: 0.8rem;
    }
}
