/*
FILE: assets/css/emed-responsive.css
PROGETTO: EMED CORE
NOTE:
- Regole comuni per monitor piccoli, notebook e future maschere touch.
- Da includere progressivamente nelle pagine principali dopo il CSS specifico pagina.
*/

:root {
    --emed-touch-target: 52px;
    --emed-touch-gap: 12px;
    --emed-sidebar-width: 300px;
    --emed-compact-sidebar: 300px;
    --emed-ui-scale: 1;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: auto;
}

img,
svg,
canvas,
video {
    max-width: 100%;
}

table {
    max-width: 100%;
}

.table-wrap,
.table-responsive,
.data-table-wrap,
.report-table-wrap,
.grid-table-wrap,
.list-wrap,
.results-wrap,
.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.btn,
.btn-light,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-uniform,
button,
input,
select,
textarea {
    max-width: 100%;
}

.btn,
.btn-light,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-uniform,
button {
    touch-action: manipulation;
}

.toolbar,
.btn-row,
.actions-row,
.action-row,
.topbar,
.topbar-left,
.topbar-right,
.table-actions,
.selection-tools,
.filter-actions,
.report-actions,
.quick-actions {
    min-width: 0;
}

.toolbar,
.btn-row,
.actions-row,
.action-row,
.table-actions,
.selection-tools,
.filter-actions,
.report-actions,
.quick-actions {
    flex-wrap: wrap;
}

.btn,
.btn-light,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-uniform {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 5px;
    line-height: 1.1;
    white-space: nowrap;
    box-sizing: border-box;
    text-decoration: none;
}

.emed-form-bottom-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin: 28px 0 8px;
    padding: 18px 0 4px;
    border-top: 1px solid #dce8f7;
}

.emed-form-bottom-actions > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 140px;
    min-height: 42px;
    padding: 6px 13px 6px 7px;
    border: 1px solid #8dccff;
    border-radius: 11px;
    background: linear-gradient(145deg, #ffffff, #e2f3ff);
    color: #125fa7;
    box-shadow: 0 3px 9px rgba(40, 83, 126, .07);
    font: 600 13px/1.3 'Segoe UI', Arial, sans-serif;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.emed-form-bottom-actions > .emed-save-bottom {
    border-color: #81dfa5;
    background: linear-gradient(145deg, #ffffff, #ddf9e9);
    color: #087542;
}

.emed-form-bottom-actions > .btn i {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    font-size: 14px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(145deg, #40b4ff, #1475df);
    box-shadow: 0 4px 9px rgba(20, 117, 223, .23);
    text-align: center;
}

.emed-form-bottom-actions > .emed-save-bottom i {
    background: linear-gradient(145deg, #3bd976, #0da14d);
    box-shadow: 0 4px 9px rgba(13, 161, 77, .23);
}

.emed-form-bottom-actions > .btn:hover {
    border-color: #74b7e8;
    box-shadow: 0 4px 12px rgba(40, 83, 126, .13);
}

.emed-form-bottom-actions > .emed-save-bottom:hover {
    border-color: #62c68b;
}

.emed-form-bottom-actions > .btn:focus-visible {
    outline: 3px solid #86bfff;
    outline-offset: 3px;
}

@media (max-width: 520px) {
    .emed-form-bottom-actions > .small { flex-basis: 100%; }
    .emed-form-bottom-actions > .btn { flex: 1 1 140px; }
}

.toolbar .btn,
.btn-row .btn,
.actions-row .btn,
.action-row .btn,
.top-actions .btn,
.selection-tools .btn,
.table-toolbar .btn,
.table-toolbar-controls .btn,
.report-actions .btn,
.filter-actions .btn,
.quick-actions .btn {
    flex: 0 0 auto;
}

.panel,
.page-card,
.module-card,
.card,
.section-panel,
.content-card,
.cash-panel,
.content,
.app-shell,
.main,
.emed-main {
    min-width: 0;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-menu a {
    min-height: 56px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 18px;
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 800;
}

.sidebar-menu a.active,
.sidebar-menu a:hover {
    background: linear-gradient(90deg, #126ad5, #0e63c7);
}

.sidebar-menu i {
    width: 26px;
    text-align: center;
    font-size: 22px;
}

@media (min-width: 901px) {
    .app,
    .layout,
    .dashboard-layout,
    .emed-app {
        grid-template-columns: var(--emed-sidebar-width) minmax(0, 1fr) !important;
    }

    .app > .sidebar,
    .layout > .sidebar,
    .dashboard-layout > .sidebar,
    .emed-app > .sidebar,
    .app > .emed-sidebar,
    .layout > .emed-sidebar,
    .dashboard-layout > .emed-sidebar,
    .emed-app > .emed-sidebar,
    .app-shell .sidebar,
    .app-shell .emed-sidebar {
        width: var(--emed-sidebar-width) !important;
        flex: 0 0 var(--emed-sidebar-width) !important;
    }

    .app-shell .main {
        margin-left: var(--emed-sidebar-width) !important;
        width: calc(100% - var(--emed-sidebar-width)) !important;
    }
}

/*
   Scala comune per maschere gestionali dense.
   Touch screen operativo e palmari devono usare layout dedicati: basta aggiungere
   body.emed-touch-mode oppure body.emed-no-auto-scale per escludere questa regola.
*/
body.emed-no-auto-scale {
    --emed-ui-scale: 1 !important;
}

/*
   Scala desktop controllata.
   Molti notebook usano 1920x1080 con Windows al 125%, quindi il browser vede
   una larghezza utile simile a 1536px: per le maschere gestionali dense conviene
   mantenere un layout virtuale piu largo e scalarlo tutto insieme.
   Touch screen operativo e palmari restano esclusi con emed-touch-mode,
   touch-active oppure emed-no-auto-scale.
*/
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) {
    --emed-ui-scale: 1 !important;
    /* CSS zoom already adjusts the available containing width.
       Dividing a percentage again makes the document overflow. */
    width: auto !important;
    min-height: calc(100vh / var(--emed-ui-scale)) !important;
    zoom: var(--emed-ui-scale) !important;
    transform-origin: top left !important;
}

@media (max-width: 2050px) and (min-width: 1901px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) { --emed-ui-scale: .82 !important; }
}

@media (max-width: 1900px) and (min-width: 1761px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) { --emed-ui-scale: .78 !important; }
}

@media (max-width: 1760px) and (min-width: 1661px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) { --emed-ui-scale: .74 !important; }
}

@media (max-width: 1660px) and (min-width: 1541px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) { --emed-ui-scale: .70 !important; }
}

@media (max-width: 1540px) and (min-width: 1441px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) { --emed-ui-scale: .66 !important; }
}

@media (max-width: 1440px) and (min-width: 1361px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) { --emed-ui-scale: .62 !important; }
}

@media (max-width: 1360px) and (min-width: 1281px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) { --emed-ui-scale: .58 !important; }
}

@media (max-width: 1280px) and (min-width: 1181px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) { --emed-ui-scale: .60 !important; }
}

@media (max-width: 1180px) and (min-width: 1101px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) { --emed-ui-scale: .56 !important; }
}

@media (max-width: 1100px) and (min-width: 981px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) { --emed-ui-scale: .52 !important; }
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-layout,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .layout,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .app,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .app-shell {
    width: 100% !important;
    min-height: 100vh !important;
    zoom: 1 !important;
    transform: none !important;
    transform-origin: top left !important;
}

@media (max-width: 1650px) and (min-width: 1501px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout {
        width: 100% !important;
        min-height: 100vh !important;
        zoom: 1 !important;
    }

    @supports not (zoom: 1) {
        body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) {
            overflow-x: auto;
        }

        body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout {
            transform: none;
            transform-origin: initial;
            width: auto;
            min-height: 100vh;
        }
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .main {
        padding: 22px 28px 22px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .topbar {
        height: 46px !important;
        margin-bottom: 14px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .hero {
        height: 210px !important;
        grid-template-columns: 1fr 560px !important;
        padding: 0 42px !important;
        margin-bottom: 14px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .hero-logo img {
        width: 460px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .modules-grid {
        grid-template-columns: repeat(3, minmax(280px, 1fr)) !important;
        gap: 12px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .module-card {
        min-height: 218px !important;
        padding: 18px 22px 15px 18px !important;
        grid-template-columns: 76px minmax(0, 1fr) !important;
        gap: 14px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .icon-box {
        width: 68px !important;
        height: 68px !important;
        font-size: 38px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .module-card h2 {
        font-size: 18px !important;
        margin: 2px 0 8px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .module-card ul {
        font-size: 13.5px !important;
        line-height: 1.48 !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .module-footer {
        margin-top: 8px !important;
        padding-top: 11px !important;
        gap: 8px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .area-btn {
        min-width: 108px !important;
        height: 34px !important;
        font-size: 13px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .stats-grid {
        grid-template-columns: repeat(6, minmax(135px, 1fr)) !important;
        gap: 10px !important;
        margin-top: 12px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout .stat-card {
        height: 82px !important;
        padding: 11px !important;
        gap: 10px !important;
    }
}

@media (max-width: 1650px) and (min-width: 981px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-layout,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .layout,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .app,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .app-shell {
        width: 100% !important;
        min-height: 100vh !important;
        zoom: 1 !important;
    }

    @supports not (zoom: 1) {
        body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) {
            overflow-x: auto;
        }

        body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-layout,
        body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .layout,
        body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout,
        body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .app,
        body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .app-shell {
            transform: none;
            transform-origin: initial;
            width: auto;
            min-height: 100vh;
        }
    }
}

@media (max-width: 1500px) {
    :root {
        --emed-sidebar-width: var(--emed-compact-sidebar);
    }

    .app,
    .layout,
    .dashboard-layout,
    .emed-app {
        grid-template-columns: var(--emed-sidebar-width) minmax(0, 1fr) !important;
    }

    .app > .sidebar,
    .layout > .sidebar,
    .dashboard-layout > .sidebar,
    .emed-app > .sidebar,
    .app > .emed-sidebar,
    .layout > .emed-sidebar,
    .dashboard-layout > .emed-sidebar,
    .emed-app > .emed-sidebar {
        width: var(--emed-sidebar-width) !important;
        flex: 0 0 var(--emed-sidebar-width) !important;
    }

    .app-shell .sidebar {
        width: var(--emed-sidebar-width) !important;
    }

    .app-shell .main {
        margin-left: var(--emed-sidebar-width) !important;
        width: calc(100% - var(--emed-sidebar-width)) !important;
    }

    .sidebar,
    .emed-sidebar {
        display: flex !important;
        min-height: 100vh;
        height: auto !important;
        overflow: visible !important;
        max-height: none !important;
        padding: 24px 16px !important;
    }

    .sidebar,
    .sidebar-menu a,
    .menu a {
        font-size: 15px;
    }

    .sidebar-menu a,
    .menu a {
        min-height: 0 !important;
        height: 56px !important;
        gap: 15px !important;
        padding-left: 18px;
        padding-right: 18px;
        white-space: nowrap;
    }

    .logo-side img {
        max-width: 235px;
    }

    .main {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    .grid,
    .form-grid,
    .grid4,
    .stats,
    .summary,
    .cards-grid,
    .dashboard-grid,
    .area-grid,
    .tile-grid,
    .module-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    }
}

@media (max-height: 820px) and (min-width: 981px) {
    .sidebar,
    .emed-sidebar {
        padding-top: 24px !important;
        padding-bottom: 24px !important;
        overflow: visible !important;
        max-height: none !important;
    }

    .logo-side {
        min-height: 96px !important;
        margin-top: -24px !important;
        margin-bottom: 24px !important;
        padding-top: 16px !important;
        padding-bottom: 16px !important;
    }

    .logo-side img {
        max-width: 235px;
    }

    .sidebar-menu a,
    .menu a {
        height: 56px !important;
        font-size: 15px !important;
    }

    .admin-box {
        display: none !important;
    }
}

@media (max-width: 1180px) and (min-width: 981px) {
    :root {
        --emed-sidebar-width: var(--emed-compact-sidebar);
    }

    .topbar {
        height: auto !important;
        min-height: 68px;
        gap: 12px;
        flex-wrap: wrap;
        align-items: center;
    }

    .app,
    .layout,
    .dashboard-layout,
    .emed-app {
        grid-template-columns: var(--emed-sidebar-width) minmax(0, 1fr) !important;
    }

    .app > .sidebar,
    .layout > .sidebar,
    .dashboard-layout > .sidebar,
    .emed-app > .sidebar,
    .app > .emed-sidebar,
    .layout > .emed-sidebar,
    .dashboard-layout > .emed-sidebar,
    .emed-app > .emed-sidebar {
        width: var(--emed-sidebar-width) !important;
        flex-basis: var(--emed-sidebar-width) !important;
    }

    .logo-side img {
        max-width: 235px;
    }

    .sidebar-menu a,
    .menu a {
        height: 56px !important;
        gap: 15px !important;
        padding-left: 18px !important;
        padding-right: 18px !important;
        font-size: 15px !important;
    }

    .topbar-right {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 10px 16px;
    }

    .order-layout,
    .work-layout,
    .cash-layout,
    .content-grid,
    .layout,
    .form-grid,
    .search-grid,
    .filters-grid,
    .advanced-builder-grid,
    .detail-summary,
    .technical-lock {
        grid-template-columns: 1fr !important;
    }

    .totals-box,
    .totals-card {
        position: static !important;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 7px;
    }
}

@media (max-width: 900px) {
    .app,
    .layout,
    .dashboard-layout {
        display: block !important;
    }

    .app-shell {
        display: block !important;
        min-height: 100vh;
    }

    .sidebar {
        display: none !important;
    }

    .main {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 14px !important;
    }

    .app-shell .main {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .topbar h1 {
        font-size: 24px !important;
    }

    .panel,
    .page-card {
        padding: 14px !important;
    }

    .grid,
    .form-grid,
    .grid4,
    .stats,
    .search-grid,
    .advanced-builder-grid,
    .article-entry-grid {
        grid-template-columns: 1fr !important;
    }
}

/*
   Standard visivo desktop: pulsanti riga e badge coerenti tra maschere.
   Le pagine possono mantenere i propri colori, ma dimensioni e forma restano ordinate.
*/
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .table-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions a,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions button,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .table-actions a,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .table-actions button,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table .btn,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table .btn-light,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table .btn-primary,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table .btn-danger,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table .btn-uniform,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table a.action-view,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table a.action-edit,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table a.action-dest,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table a.action-delete {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 92px !important;
    min-width: 92px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 8px !important;
    border-radius: 4px !important;
    border-width: 1px !important;
    border-style: solid !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    text-decoration: none !important;
    box-shadow: 0 3px 8px rgba(15, 34, 67, .06) !important;
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table .btn-light,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) table a[href*="duplica"] {
    border-color: #c9d8eb !important;
    background: linear-gradient(180deg, #ffffff, #f3f8ff) !important;
    color: #0b5ed7 !important;
}

body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .table-scroll table th:nth-child(2),
body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .table-scroll table td.row-actions {
    width: 370px !important;
    min-width: 370px !important;
}

body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .table-scroll table td.row-actions {
    display: table-cell !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
}

body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions-inner {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    width: max-content !important;
    max-width: 100% !important;
}

body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions a,
body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions button.btn-row-delete {
    flex: 0 0 auto !important;
    height: 30px !important;
    min-height: 30px !important;
    margin-right: 0 !important;
    border-radius: 4px !important;
    font-weight: 900 !important;
}

body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions form {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
}

body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions a.action-edit-article {
    width: 88px !important;
    min-width: 88px !important;
    border-color: #164c83 !important;
    background: linear-gradient(180deg, #2b6fab 0%, #174f88 52%, #123d6b 100%) !important;
    color: #ffffff !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 4px 10px rgba(15,58,102,.22) !important;
}

body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions a.action-components-article {
    width: 96px !important;
    min-width: 96px !important;
    border-color: #0f8ca5 !important;
    background: linear-gradient(180deg, #41d7ed 0%, #13a5c1 48%, #087d9a 100%) !important;
    color: #ffffff !important;
    text-shadow: 0 1px 0 rgba(0,0,0,.22) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.34), 0 4px 12px rgba(8,125,154,.24) !important;
}

body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions a.action-duplicate-article {
    width: 78px !important;
    min-width: 78px !important;
    border-color: #b8c8e0 !important;
    background: linear-gradient(180deg, #ffffff 0%, #eff6ff 50%, #dfeafd 100%) !important;
    color: #0b5ed7 !important;
}

body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .row-actions button.btn-row-delete {
    width: 78px !important;
    min-width: 78px !important;
    border-color: #ffb0a8 !important;
    background: linear-gradient(180deg, #fff3f1 0%, #ffd9d4 52%, #ffc5bd 100%) !important;
    color: #ad2018 !important;
}

body.page-articoli:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .table-scroll table tbody td {
    border-bottom-color: #dbe3ee !important;
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .badge,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .tag,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .status,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .command-reprint-badge,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .return-state-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 82px !important;
    height: 22px !important;
    min-height: 22px !important;
    padding: 0 8px !important;
    border-radius: 4px !important;
    border-width: 1px !important;
    border-left-width: 3px !important;
    border-style: solid !important;
    line-height: 1 !important;
    font-size: 10.5px !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
    text-transform: uppercase !important;
    white-space: nowrap !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 3px 8px rgba(15,34,67,.05) !important;
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .tag {
    border-radius: 4px !important;
}

/* Standard visivo back office: toolbar legacy e toolbar nuove devono avere la stessa taglia. */
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-action-toolbar {
    gap: 10px !important;
    padding: 12px !important;
    border-radius: 14px !important;
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-action-tile {
    width: 108px !important;
    min-width: 108px !important;
    height: 94px !important;
    min-height: 94px !important;
    border-radius: 13px !important;
    padding: 7px 8px !important;
    gap: 3px !important;
    background:
        linear-gradient(180deg, rgba(255,255,255,.96) 0%, var(--tile-bg1, #f4f8ff) 52%, var(--tile-bg2, #ffffff) 100%) !important;
    box-shadow: 0 6px 16px rgba(20,38,78,0.055) !important;
    font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif !important;
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile i,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-action-icon {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 11px !important;
    font-size: 19px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #ffffff !important;
    background: linear-gradient(145deg, var(--tile-color2, #4aa3ff) 0%, var(--tile-color, #1d538d) 100%) !important;
    box-shadow:
        inset 0 -4px 8px rgba(0,0,0,.10),
        0 7px 15px var(--tile-glow, rgba(13,110,253,.18)) !important;
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile strong,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-action-label {
    min-height: 24px !important;
    max-height: 24px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: uppercase !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile span,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-action-subtitle {
    min-height: 12px !important;
    max-height: 12px !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
    font-weight: 400 !important;
    color: #52657d !important;
    text-align: center !important;
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile.blue,
body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile:not(.orange):not(.green):not(.purple):not(.gray):not(.cyan) {
    --tile-color:#0d6efd; --tile-color2:#4aa3ff; --tile-bg1:#eef6ff; --tile-bg2:#ffffff; --tile-border:#cfe2ff; --tile-glow:rgba(13,110,253,.24);
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile.orange {
    --tile-color:#ff8200; --tile-color2:#ffb347; --tile-bg1:#fff4e8; --tile-bg2:#ffffff; --tile-border:#ffd9ad; --tile-glow:rgba(255,130,0,.24);
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile.green {
    --tile-color:#16a34a; --tile-color2:#4ade80; --tile-bg1:#edfdf4; --tile-bg2:#ffffff; --tile-border:#c8f3d7; --tile-glow:rgba(22,163,74,.22);
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile.purple {
    --tile-color:#7c3aed; --tile-color2:#a855f7; --tile-bg1:#f5efff; --tile-bg2:#ffffff; --tile-border:#dfccff; --tile-glow:rgba(124,58,237,.22);
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile.cyan {
    --tile-color:#0891b2; --tile-color2:#22d3ee; --tile-bg1:#ecfeff; --tile-bg2:#ffffff; --tile-border:#b9f2fb; --tile-glow:rgba(8,145,178,.20);
}

body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band .tile.gray {
    --tile-color:#475569; --tile-color2:#94a3b8; --tile-bg1:#f4f7fb; --tile-bg2:#ffffff; --tile-border:#dbe3ee; --tile-glow:rgba(71,85,105,.16);
}

@media (max-width: 1900px) and (min-width: 901px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-action-toolbar {
        gap: 10px !important;
        padding: 12px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-action-tile {
        width: 108px !important;
        min-height: 94px !important;
    }
}

@media (max-width: 1500px) and (min-width: 901px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-action-tile {
        width: 108px !important;
        height: 94px !important;
        min-height: 94px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-action-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 19px !important;
    }
}

body.emed-touch-mode {
    overflow: hidden;
}

body.emed-touch-mode .btn,
body.emed-touch-mode .btn-light,
body.emed-touch-mode .btn-primary,
body.emed-touch-mode .btn-secondary,
body.emed-touch-mode .btn-danger,
body.emed-touch-mode button,
body.emed-touch-mode input,
body.emed-touch-mode select {
    min-height: var(--emed-touch-target);
}

body.emed-touch-mode .touch-grid,
body.emed-touch-mode .tile-grid,
body.emed-touch-mode .payment-choice-grid {
    gap: var(--emed-touch-gap);
}

body.emed-touch-mode .touch-action,
body.emed-touch-mode .tile,
body.emed-touch-mode .payment-choice {
    min-height: 76px;
}

@media (pointer: coarse) {
    .btn,
    .btn-light,
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .btn-uniform,
    button {
        min-height: 44px;
    }

    input,
    select {
        min-height: 42px;
    }
}

/*
   Blocco finale desktop back office.
   Deve restare in fondo: uniforma menu laterale e shell dopo le regole locali
   delle singole pagine, senza entrare nel mondo touch/palmare.
*/
@media (min-width: 981px) {
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .app,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-layout,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .dashboard-layout,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-app {
        display: grid !important;
        grid-template-columns: var(--emed-sidebar-width) minmax(0, 1fr) !important;
        column-gap: 18px !important;
        width: 100% !important;
        min-height: 100vh !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .sidebar,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-sidebar {
        width: var(--emed-sidebar-width) !important;
        min-width: var(--emed-sidebar-width) !important;
        max-width: var(--emed-sidebar-width) !important;
        flex: 0 0 var(--emed-sidebar-width) !important;
        padding: 24px 16px !important;
        font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .main,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-main {
        min-width: 0 !important;
        padding-left: 10px !important;
        padding-right: 28px !important;
        box-sizing: border-box !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .logo-side,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-logo-side {
        min-height: 96px !important;
        margin: -24px -16px 24px !important;
        padding: 16px 14px !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .logo-side img,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-logo-side img {
        width: 235px !important;
        max-width: 100% !important;
        height: auto !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .sidebar-menu,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .menu,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-menu,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-sidebar-menu {
        gap: 8px !important;
        font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .sidebar-menu a,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .menu a,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-menu a,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-sidebar-menu a {
        height: 56px !important;
        min-height: 56px !important;
        border-radius: 11px !important;
        gap: 15px !important;
        padding: 0 18px !important;
        font-size: 15px !important;
        line-height: 1.1 !important;
        font-weight: 500 !important;
        white-space: nowrap !important;
        letter-spacing: 0 !important;
        text-transform: uppercase !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .sidebar-menu i,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .menu i,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-menu i,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-sidebar-menu i {
        width: 26px !important;
        min-width: 26px !important;
        font-size: 22px !important;
        text-align: center !important;
    }

    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .toolbar-band,
    body:not(.emed-touch-mode):not(.emed-no-auto-scale):not(.touch-active) .emed-action-toolbar {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        overflow: visible !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

