/************************************************************
 * FONT E BASE
 ************************************************************/
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: var(--ab-t-006bb7, #006bb7);
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

/************************************************************
 * BOOTSTRAP OVERRIDE
 ************************************************************/
.btn-primary {
    color: var(--ab-t-ffffff, #fff);
    background-color: var(--ab-s-1b6ec2, #1b6ec2);
    border-color: var(--ab-b-1861ac, #1861ac);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem var(--ab-b-ffffff, white), 0 0 0 0.25rem var(--ab-b-258cfb, #258cfb);
}

.darker-border-checkbox.form-check-input {
    border-color: var(--ab-b-929292, #929292);
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/************************************************************
 * VALIDAZIONE BLAZOR
 ************************************************************/
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--ab-b-26b050, #26b050);
}

.invalid {
    outline: 1px solid var(--ab-b-e50000, #e50000);
}

.validation-message {
    color: var(--ab-t-e50000, #e50000);
}

/************************************************************
 * ERROR UI BLAZOR
 ************************************************************/
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbmsiPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: var(--ab-t-ffffff, white);
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

/************************************************************
 * LAYOUT GRID (desktop)
 ************************************************************/
.page-grid-container {
    min-height: calc(100vh - 140px);
    display: flex;
}

.flexGrid {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
}

/************************************************************
 * OVERLAY DI CARICAMENTO
 ************************************************************/
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, .7);
    display: grid;
    place-items: center;
    z-index: 1055;
}

/************************************************************
 * ICONA COLLASSO
 ************************************************************/
.collapse-toggle .bi-chevron-down {
    transition: transform .2s ease;
}

.collapse-toggle:not(.collapsed) .bi-chevron-down {
    transform: rotate(180deg);
}

/************************************************************
 * DEVEXPRESS FIX - input-group combobox
 ************************************************************/
.input-group .dxbl-combobox {
    flex: 1 1 auto;
    width: 1% !important;
    min-width: 0;
}

/************************************************************
 * MOBILE - Layout grid
 ************************************************************/
@media (max-width: 576px) {
    .page-grid-container {
        min-height: calc(100vh - 100px);
    }

    .card.card-body.p-2 {
        padding: .5rem !important;
    }
}

/************************************************************
 * MOBILE - Stack verticale tabella righe documento
 ************************************************************/
@media (max-width: 768px) {

    /* Nasconde header tabella */
    table.responsive-stacked thead {
        display: none !important;
    }

    /* Ogni riga diventa una card */
    table.responsive-stacked tr {
        display: flex !important;
        flex-direction: column !important;
        border: 1px solid var(--ab-b-dddddd, #ddd);
        border-radius: 8px;
        padding: 10px;
        margin-bottom: 1rem;
        background: var(--ab-s-ffffff, #fff);
        gap: 12px;
    }

    /* Celle in colonna */
    table.responsive-stacked td {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        white-space: normal !important;
    }

        /* Etichetta data-label sopra al controllo */
        table.responsive-stacked td::before {
            content: attr(data-label);
            font-size: .85rem;
            font-weight: 600;
            color: var(--ab-t-444444, #444);
            margin-bottom: 4px;
        }

    /* Controlli DevExpress a full width */
    table.responsive-stacked .dxbs-editor,
    table.responsive-stacked .dxbl-input,
    table.responsive-stacked .form-control,
    table.responsive-stacked .form-select,
    table.responsive-stacked .dxbs-texteditor-input-container,
    table.responsive-stacked .dxbs-combobox-container {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: block !important;
        box-sizing: border-box !important;
    }

    .dxbs-combobox,
    .dxbs-editor {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/************************************************************
 * MOBILE - Stack verticale testata e dati aggiuntivi
 ************************************************************/
@media (max-width: 768px) {

    .mobile-stack .row {
        display: block !important;
        margin-bottom: 1rem !important;
    }

    .mobile-stack label {
        display: block !important;
        margin-bottom: .25rem;
        font-weight: 600;
    }

    .mobile-stack [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    .mobile-stack .dxbs-editor,
    .mobile-stack .dxbl-input,
    .mobile-stack .form-control,
    .mobile-stack .form-select {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .mobile-stack .icon-button-col {
        margin-top: .5rem;
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }
}

/************************************************************
 * FE - VARIABILI GLOBALI
 ************************************************************/
:root {
    --fe-blue: var(--ab-a-1a56db, #1a56db);
    --fe-blue-light: var(--ab-s-eff4ff, #eff4ff);
    --fe-blue-mid: var(--ab-s-dce8ff, #dce8ff);
    --fe-border: var(--ab-b-e2e8f5, #e2e8f5);
    --fe-bg: var(--ab-s-f7f9fc, #f7f9fc);
    --fe-text: var(--ab-t-1e2d5a, #1e2d5a);
    --fe-text-muted: var(--ab-t-6b7cad, #6b7cad);
    --fe-radius: 10px;
    --fe-shadow: 0 2px 8px rgba(26,86,219,.07);
}

/************************************************************
 * FE - LOADING OVERLAY
 ************************************************************/
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--ab-s-f7f9fce0, rgba(247,249,252,.88));
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fe-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.fe-spinner-ring {
    width: 48px;
    height: 48px;
    border: 4px solid var(--fe-blue-mid);
    border-top-color: var(--fe-blue);
    border-radius: 50%;
    animation: fe-spin .75s linear infinite;
}

.fe-spinner-label {
    font-size: .9rem;
    color: var(--fe-text-muted);
    font-weight: 500;
}

@keyframes fe-spin {
    to {
        transform: rotate(360deg);
    }
}

/************************************************************
 * FE - TOOLBAR
 ************************************************************/
.tb-bar {
    position: sticky;
    top: calc(54px + var(--bs-bar-h, 0px)); /* sotto la top-navbar fixed e la BarraSchede (--bs-bar-h da js/barraSchedeAltezza.js) */
    z-index: 100;
    background: var(--ab-s-ffffff, #ffffff);
    border-bottom: 1px solid var(--ab-b-e2e8f5, #e2e8f5);
    box-shadow: 0 2px 8px rgba(26,86,219,.07);
}

.tb-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .55rem 1.1rem;
    gap: 1rem;
}

.tb-caption {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--ab-t-1e2d5a, #1e2d5a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tb-caption-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ab-s-1a56db, #1a56db), var(--ab-s-3b82f6, #3b82f6));
    box-shadow: 0 0 0 2px rgba(26,86,219,.2);
}

.tb-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
}

.tb-divider {
    width: 1px;
    height: 24px;
    background: var(--ab-s-dde4f5, #dde4f5);
    margin: 0 .2rem;
}

.tb-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1.5px solid transparent;
    border-radius: 8px;
    padding: .38rem .85rem;
    font-size: .83rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
    line-height: 1.4;
}

    .tb-btn i {
        font-size: .95rem;
    }

.tb-btn-secondary {
    background: var(--ab-s-f4f7ff, #f4f7ff);
    border-color: var(--ab-b-c8d3f0, #c8d3f0);
    color: var(--ab-t-3b5bdb, #3b5bdb);
}

    .tb-btn-secondary:hover {
        background: var(--ab-s-e8eeff, #e8eeff);
        border-color: var(--ab-b-1a56db, #1a56db);
        color: var(--ab-t-1a56db, #1a56db);
        box-shadow: 0 2px 8px rgba(26,86,219,.12);
        transform: translateY(-1px);
    }

.tb-btn-primary {
    background: linear-gradient(135deg, var(--ab-s-1a56db, #1a56db) 0%, var(--ab-s-0e3fa8, #0e3fa8) 100%);
    border-color: transparent;
    color: var(--ab-t-ffffff, #ffffff);
    box-shadow: 0 2px 6px rgba(26,86,219,.30);
}

    .tb-btn-primary:hover {
        background: linear-gradient(135deg, var(--ab-s-1d4ed8, #1d4ed8) 0%, var(--ab-s-1e40af, #1e40af) 100%);
        box-shadow: 0 4px 14px rgba(26,86,219,.38);
        transform: translateY(-1px);
        color: var(--ab-t-ffffff, #fff);
    }

/* Stampa — azzurro (anche fuori dalla ToolbarED: pagine di evasione e trasformazione) */
.tb-btn-print {
    background: var(--ab-s-eff6ff, #eff6ff);
    border-color: var(--ab-b-bfdbfe, #bfdbfe);
    color: var(--ab-t-1d4ed8, #1d4ed8);
}

    .tb-btn-print:hover {
        background: var(--ab-s-dbeafe, #dbeafe);
        border-color: var(--ab-b-1d4ed8, #1d4ed8);
        color: var(--ab-t-1d4ed8, #1d4ed8);
        box-shadow: 0 2px 8px rgba(29, 78, 216, .15);
        transform: translateY(-1px);
    }

.tb-btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }

.tb-btn-danger {
    background: var(--ab-s-fff5f5, #fff5f5);
    border-color: var(--ab-b-fecaca, #fecaca);
    color: var(--ab-t-dc2626, #dc2626);
}

    .tb-btn-danger:hover {
        background: var(--ab-s-fee2e2, #fee2e2);
        border-color: var(--ab-b-dc2626, #dc2626);
        box-shadow: 0 2px 8px rgba(220,38,38,.15);
        transform: translateY(-1px);
    }

@media (max-width: 575px) {
    .tb-inner {
        padding: .45rem .75rem;
        gap: .5rem;
    }

    .tb-btn-label {
        display: none;
    }

    .tb-btn {
        padding: .42rem .55rem;
        border-radius: 8px;
    }

        .tb-btn i {
            font-size: 1.05rem;
        }
}

/************************************************************
 * FE - SEZIONI
 ************************************************************/
.fe-section {
    background: var(--ab-s-ffffff, #fff);
    border: 1px solid var(--fe-border);
    border-radius: var(--fe-radius);
    box-shadow: var(--fe-shadow);
    overflow: hidden;
}

.fe-section-header {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .65rem 1.1rem;
    background: linear-gradient(135deg, var(--ab-s-f0f5ff, #f0f5ff) 0%, var(--ab-s-e8efff, #e8efff) 100%);
    border-bottom: 1px solid var(--fe-border);
    font-size: .82rem;
    font-weight: 700;
    color: var(--fe-blue);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.fe-section-icon {
    font-size: .95rem;
}

.fe-section-body {
    padding: 1rem 1.1rem;
}

/************************************************************
 * FE - FIELD ROWS
 ************************************************************/
.fe-field-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
    flex-wrap: wrap;
}

.fe-field-row--split {
    align-items: flex-start;
}

.fe-label {
    flex: 0 0 130px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--fe-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding-top: .42rem;
}

.fe-label-code {
    font-weight: 400;
    font-size: .75rem;
    color: var(--ab-t-aab0cc, #aab0cc);
}

.fe-control {
    flex: 1;
    min-width: 0;
}

.fe-control--error {
    outline: 2px solid var(--ab-b-ef4444, #ef4444);
    outline-offset: 2px;
    border-radius: 6px;
}

.fe-control--short {
    max-width: 360px;
}

.fe-field-group {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    flex: 1;
    min-width: 0;
}

.fe-field-group--xs {
    flex: 0 0 100px;
}

.fe-field-group--sm {
    flex: 0 0 200px;
}

.fe-field-group--md {
    flex: 1;
}

.fe-field-group--lg {
    flex: 2;
}

.fe-field-group .fe-label {
    flex: none;
    padding-top: 0;
}

.fe-field-group .fe-control {
    flex: none;
    width: 100%;
}

/************************************************************
 * FE - SEARCH BUTTON
 ************************************************************/
.fe-search-btn {
    background: var(--fe-blue-light);
    border: 1.5px solid var(--fe-blue-mid);
    color: var(--fe-blue);
    transition: all .15s;
}

    .fe-search-btn:hover {
        background: var(--fe-blue);
        color: var(--ab-t-ffffff, #fff);
        border-color: var(--fe-blue);
    }

/************************************************************
 * FE - COLLAPSE TRIGGER
 ************************************************************/
.fe-collapse-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .6rem;
    background: var(--ab-s-ffffff, #fff);
    border: 1px solid var(--fe-border);
    border-radius: var(--fe-radius);
    padding: .6rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--fe-text);
    cursor: pointer;
    transition: all .15s;
    text-align: left;
    box-shadow: var(--fe-shadow);
}

    .fe-collapse-btn:hover {
        background: var(--fe-blue-light);
        border-color: var(--fe-blue-mid);
        color: var(--fe-blue);
    }

.fe-collapse-icon {
    width: 24px;
    height: 24px;
    background: var(--fe-blue-light);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fe-blue);
    font-size: .8rem;
    flex-shrink: 0;
    transition: transform .2s;
}

.fe-collapse-btn[aria-expanded="true"] .fe-collapse-icon {
    transform: rotate(180deg);
    background: var(--fe-blue);
    color: var(--ab-t-ffffff, #fff);
}

.fe-collapse-label {
    flex: 1;
}

.fe-collapse-badge {
    background: var(--fe-blue);
    color: var(--ab-t-ffffff, #fff);
    border-radius: 20px;
    padding: .1rem .55rem;
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
}

/************************************************************
 * FE - TABELLE
 ************************************************************/
.fe-table thead th {
    background: var(--ab-s-f4f7ff, #f4f7ff);
    color: var(--fe-text-muted);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 2px solid var(--fe-border);
    padding: .55rem .75rem;
    white-space: nowrap;
}

.fe-table tbody td {
    padding: .45rem .75rem;
    border-color: var(--ab-b-f0f3fb, #f0f3fb);
    font-size: .875rem;
    color: var(--fe-text);
}

.fe-table tbody tr:hover {
    background: var(--ab-s-f8faff, #f8faff) !important;
}

.fe-table-empty {
    text-align: center;
    color: var(--fe-text-muted);
    padding: 2rem !important;
    font-size: .875rem;
}

.fe-row-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--fe-blue-light);
    color: var(--fe-blue);
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 700;
}

.fe-row-delete {
    background: none;
    border: none;
    color: var(--ab-t-aab0cc, #aab0cc);
    font-size: .95rem;
    padding: .2rem .4rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all .12s;
}

    .fe-row-delete:hover {
        background: var(--ab-s-fee2e2, #fee2e2);
        color: var(--ab-t-dc2626, #dc2626);
    }

.fe-row-drag {
    background: none;
    border: none;
    color: var(--ab-t-c5cde8, #c5cde8);
    font-size: 1rem;
    padding: .2rem .4rem;
    cursor: move;
    border-radius: 6px;
    transition: color .12s;
}

    .fe-row-drag:hover {
        color: var(--fe-blue);
    }

/************************************************************
 * FE - TABLE FOOTER / AGGIUNGI / ELIMINA
 ************************************************************/
.fe-table-footer {
    display: flex;
    justify-content: flex-end;
    padding: .5rem 0;
}

.fe-add-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--ab-s-f0fdf4, #f0fdf4);
    border: 1.5px solid var(--ab-b-bbf7d0, #bbf7d0);
    color: var(--ab-t-16a34a, #16a34a);
    border-radius: 8px;
    padding: .4rem .9rem;
    font-size: .83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

    .fe-add-btn:hover {
        background: var(--ab-s-16a34a, #16a34a);
        color: var(--ab-t-ffffff, #fff);
        border-color: var(--ab-b-16a34a, #16a34a);
        box-shadow: 0 2px 8px rgba(22,163,74,.2);
    }

.fe-add-btn--sm {
    font-size: .78rem;
    padding: .3rem .7rem;
}

.fe-del-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--ab-s-fff5f5, #fff5f5);
    border: 1.5px solid var(--ab-b-fecaca, #fecaca);
    color: var(--ab-t-dc2626, #dc2626);
    border-radius: 8px;
    padding: .4rem .9rem;
    font-size: .83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

    .fe-del-btn:hover {
        background: var(--ab-s-dc2626, #dc2626);
        color: var(--ab-t-ffffff, #fff);
        border-color: var(--ab-b-dc2626, #dc2626);
    }

.fe-del-btn--sm {
    font-size: .78rem;
    padding: .3rem .7rem;
}

/************************************************************
 * FE - IVA + TOTALI
 ************************************************************/
.fe-iva-badge {
    background: var(--ab-s-eff6ff, #eff6ff);
    color: var(--ab-t-1d4ed8, #1d4ed8);
    padding: .15rem .45rem;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 600;
    font-family: monospace;
}

.fe-amount {
    font-family: monospace;
    font-size: .875rem;
}

.fe-totals {
    background: var(--fe-bg);
    border-top: 1px solid var(--fe-border);
    padding: 1rem 1.1rem;
    display: flex;
    justify-content: flex-end;
}

.fe-totals-inner {
    min-width: 280px;
}

.fe-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .3rem 0;
    font-size: .875rem;
    color: var(--fe-text);
}

.fe-total-label {
    color: var(--fe-text-muted);
}

.fe-total-value {
    font-family: monospace;
    font-weight: 500;
}

.fe-total-divider {
    border-top: 2px solid var(--fe-border);
    margin: .5rem 0;
}

.fe-total-row--grand {
    font-weight: 700;
    font-size: .95rem;
}

.fe-total-row--netto {
    background: var(--fe-blue);
    color: var(--ab-t-ffffff, #fff);
    padding: .5rem .75rem;
    border-radius: 8px;
    margin-top: .3rem;
}

    .fe-total-row--netto .fe-total-label {
        color: var(--ab-t-ffffffcc, rgba(255,255,255,.8));
    }

.fe-total-value--netto {
    font-size: 1.05rem;
    color: var(--ab-t-ffffff, #fff);
}

/************************************************************
 * FE - DATI AGGIUNTIVI / CORRELATI
 ************************************************************/
.fe-subsection-header {
    font-size: .8rem;
    font-weight: 700;
    color: var(--fe-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .75rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--fe-border);
}

.fe-subsection-body {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.fe-corr-row {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    padding: .75rem;
    background: var(--fe-bg);
    border: 1px solid var(--fe-border);
    border-radius: 8px;
}

.fe-corr-field {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    flex: 1;
    min-width: 110px;
}

.fe-corr-field--xs {
    flex: 0 0 80px;
    min-width: 80px;
}

.fe-label-sm {
    font-size: .72rem;
    font-weight: 600;
    color: var(--fe-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.fe-corr-actions {
    display: flex;
    gap: .5rem;
    margin-top: .75rem;
}

/************************************************************
 * FE - MODALI
 ************************************************************/
.fe-modal-error .modal-header {
    background: linear-gradient(135deg, var(--ab-s-dc2626, #dc2626), var(--ab-s-b91c1c, #b91c1c));
    color: var(--ab-t-ffffff, #fff);
    border: none;
}

.fe-modal-success .modal-header {
    background: linear-gradient(135deg, var(--ab-s-16a34a, #16a34a), var(--ab-s-15803d, #15803d));
    color: var(--ab-t-ffffff, #fff);
    border: none;
}

.fe-modal-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.fe-modal-icon--error {
    background: rgba(255,255,255,.2);
}

.fe-modal-icon--success {
    background: rgba(255,255,255,.2);
}

.fe-error-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

    .fe-error-list li {
        display: flex;
        align-items: flex-start;
        gap: .4rem;
        padding: .35rem 0;
        border-bottom: 1px solid var(--ab-b-fee2e2, #fee2e2);
        font-size: .875rem;
        color: var(--ab-t-7f1d1d, #7f1d1d);
    }

        .fe-error-list li:last-child {
            border-bottom: none;
        }

.fe-success-circle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--ab-s-16a34a, #16a34a), var(--ab-s-15803d, #15803d));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 2rem;
    color: var(--ab-t-ffffff, #fff);
    box-shadow: 0 4px 20px rgba(22,163,74,.3);
}

.fe-modal-btn-error {
    background: var(--ab-s-dc2626, #dc2626);
    color: var(--ab-t-ffffff, #fff);
    border: none;
    border-radius: 8px;
    padding: .4rem 1.2rem;
    font-weight: 500;
}

    .fe-modal-btn-error:hover {
        background: var(--ab-s-b91c1c, #b91c1c);
        color: var(--ab-t-ffffff, #fff);
    }

.fe-modal-btn-success {
    background: var(--ab-s-16a34a, #16a34a);
    color: var(--ab-t-ffffff, #fff);
    border: none;
    border-radius: 8px;
    padding: .4rem 1.2rem;
    font-weight: 500;
}

    .fe-modal-btn-success:hover {
        background: var(--ab-s-15803d, #15803d);
        color: var(--ab-t-ffffff, #fff);
    }

/************************************************************
 * FE - MOBILE
 ************************************************************/
@media (max-width: 767px) {
    .fe-field-row {
        flex-direction: column;
        align-items: stretch;
    }

    .fe-label {
        flex: none;
        padding-top: 0;
    }

    .fe-field-row--split {
        flex-direction: column;
    }

    .fe-field-group--xs,
    .fe-field-group--sm,
    .fe-field-group--md,
    .fe-field-group--lg {
        flex: none;
        width: 100%;
    }

    .fe-section-body {
        padding: .75rem;
    }

    .fe-totals {
        justify-content: stretch;
    }

    .fe-totals-inner {
        width: 100%;
    }
}

/************************************************************
 * PRATICHE - BOTTONI
 * Stesso stile dei bottoni di TestateDoc: pieno blu per l'azione
 * principale, bianco per le secondarie, rosso per quelle distruttive.
 * Usato da tutti i componenti di Components/Pratiche.
 ************************************************************/
.pr-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: linear-gradient(135deg, var(--ab-s-1a56db, #1a56db) 0%, var(--ab-s-0e3fa8, #0e3fa8) 100%);
    color: var(--ab-t-ffffff, #fff);
    border: 1.5px solid transparent;
    border-radius: 8px;
    padding: .38rem .9rem;
    font-size: .84rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: all .15s ease;
    box-shadow: 0 2px 6px rgba(26,86,219,.30);
}

    .pr-btn:hover:not(:disabled) {
        background: linear-gradient(135deg, var(--ab-s-0e3fa8, #0e3fa8), var(--ab-s-0a2d7d, #0a2d7d));
        box-shadow: 0 4px 14px rgba(26,86,219,.38);
        transform: translateY(-1px);
    }

    .pr-btn:disabled {
        opacity: .55;
        cursor: not-allowed;
        box-shadow: none;
        transform: none;
    }

    .pr-btn i {
        font-size: .95rem;
    }

/* Azione secondaria: bianca con bordo, diventa blu al passaggio del mouse */
.pr-btn--secondary {
    background: var(--ab-s-ffffff, #fff);
    border-color: var(--ab-b-d0d9ef, #d0d9ef);
    color: var(--ab-t-4a5580, #4a5580);
    box-shadow: none;
}

    .pr-btn--secondary:hover:not(:disabled) {
        background: var(--ab-s-eef2ff, #eef2ff);
        border-color: var(--ab-b-1a56db, #1a56db);
        color: var(--ab-t-1a56db, #1a56db);
        box-shadow: 0 2px 8px rgba(26,86,219,.15);
    }

/* Azione distruttiva */
.pr-btn--danger {
    background: var(--ab-s-dc2626, #dc2626);
    border-color: var(--ab-b-dc2626, #dc2626);
    color: var(--ab-t-ffffff, #fff);
    box-shadow: 0 2px 6px rgba(220,38,38,.3);
}

    .pr-btn--danger:hover:not(:disabled) {
        background: var(--ab-s-b91c1c, #b91c1c);
        border-color: var(--ab-b-b91c1c, #b91c1c);
        box-shadow: 0 4px 12px rgba(220,38,38,.38);
    }

/* Variante compatta per i pulsanti dentro i campi (es. la lente di ricerca) */
.pr-btn--icona {
    padding: .3rem .55rem;
}

/************************************************************
 * PRATICHE - INTESTAZIONE DI PAGINA
 * Stessa barra blu di TestateDoc: icona, titolo, sottotitolo e
 * comandi della maschera sulla destra.
 ************************************************************/
.pr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    background: linear-gradient(135deg, var(--ab-s-1a56db, #1a56db) 0%, var(--ab-s-0e3fa8, #0e3fa8) 100%);
    border-radius: 10px;
    padding: .8rem 1.2rem;
    box-shadow: 0 4px 16px rgba(26,86,219,.25);
    margin-bottom: .75rem;
}

.pr-header-inner {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.pr-header-icon {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,.18);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--ab-t-ffffff, #fff);
}

.pr-header-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ab-t-ffffff, #fff);
    display: flex;
    align-items: center;
    gap: .5rem;
}

.pr-header-sub {
    font-size: .78rem;
    color: rgba(255,255,255,.72);
    margin-top: .1rem;
}

.pr-header-right {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}

/* Contatore accanto al titolo */
.pr-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 .45rem;
    background: var(--ab-s-ffffff, #fff);
    color: var(--ab-t-1a56db, #1a56db);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}

/* Bottoni dentro la barra blu: contorno bianco, oppure bianchi pieni per l'azione principale */
.pr-btn--header {
    background: transparent;
    border-color: rgba(255,255,255,.30);
    color: var(--ab-t-ffffff, #fff);
    box-shadow: none;
}

    .pr-btn--header:hover:not(:disabled) {
        background: rgba(255,255,255,.15);
        border-color: rgba(255,255,255,.55);
        color: var(--ab-t-ffffff, #fff);
        box-shadow: none;
    }

.pr-btn--header-pieno {
    background: var(--ab-s-fffffff2, rgba(255,255,255,.95));
    border-color: rgba(255,255,255,.6);
    color: var(--ab-t-1a56db, #1a56db);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
}

    .pr-btn--header-pieno:hover:not(:disabled) {
        background: var(--ab-s-ffffff, #fff);
        color: var(--ab-t-1a56db, #1a56db);
        box-shadow: 0 4px 12px rgba(0,0,0,.15);
    }

/************************************************************
 * MAGAZZINO - RIQUADRI E CAMPI
 * Le maschere di Components/Magazzino riprendono la disposizione
 * delle form legacy: i GroupControl diventano riquadri con titolo
 * (mg-gruppo), affiancati in colonne che vanno a capo sul telefono.
 ************************************************************/
.mg-pagina {
    padding: 1rem;
}

.mg-griglia-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: .6rem;
    margin-bottom: .6rem;
    align-items: start;
}

.mg-colonne {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: .6rem;
    align-items: stretch;
}

    .mg-colonne > * {
        flex: 1 1 300px;
        min-width: 0;
    }

.mg-colonna {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.mg-gruppo {
    background: var(--ab-s-ffffff, #fff);
    border: 1px solid var(--ab-b-d6e0f5, #d6e0f5);
    border-radius: 10px;
    padding: .35rem .75rem .6rem;
    margin: 0;
    min-width: 0;
    box-shadow: 0 1px 4px rgba(26,86,219,.06);
}

    .mg-gruppo > legend {
        float: none;
        width: auto;
        padding: 0 .35rem;
        margin: 0 0 .15rem;
        font-size: .74rem;
        font-weight: 700;
        color: var(--ab-t-1a56db, #1a56db);
        text-transform: none;
    }

.mg-riga {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem .9rem;
    margin-top: .3rem;
}

.mg-campo {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
}

    .mg-campo > label {
        font-size: .8rem;
        color: var(--ab-t-4a5580, #4a5580);
        white-space: nowrap;
        margin: 0;
    }

    .mg-campo .form-control,
    .mg-campo .form-select {
        min-width: 0;
    }

.mg-campo--largo {
    flex: 1 1 260px;
}

.mg-campo--verticale {
    flex-direction: column;
    align-items: stretch;
    gap: .15rem;
}

.mg-check {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    color: var(--ab-t-1e2d5a, #1e2d5a);
    cursor: pointer;
    margin: 0;
    user-select: none;
}

    .mg-check input[type=checkbox],
    .mg-check input[type=radio] {
        width: 1rem;
        height: 1rem;
        accent-color: var(--ab-a-1a56db, #1a56db);
        cursor: pointer;
    }

    .mg-check.disabilitato {
        opacity: .5;
        cursor: not-allowed;
    }

.mg-descrizione {
    flex: 1 1 auto;
    min-width: 0;
    font-size: .82rem;
    color: var(--ab-t-1e2d5a, #1e2d5a);
    background: var(--ab-s-f5f8ff, #f5f8ff);
    border: 1px solid var(--ab-b-e2e8f5, #e2e8f5);
    border-radius: 6px;
    padding: .28rem .55rem;
    min-height: 1.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mg-valore {
    font-weight: 700;
    color: var(--ab-t-1e2d5a, #1e2d5a);
    font-variant-numeric: tabular-nums;
}

.mg-sezione {
    background: var(--ab-s-ffffff, #fff);
    border: 1px solid var(--ab-b-e2e8f5, #e2e8f5);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(26,86,219,.07);
    overflow: hidden;
    margin-bottom: .6rem;
}

/* Barra di stato in fondo (la RibbonStatusBar del legacy con l'azienda) */
.mg-stato {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem 1.2rem;
    font-size: .75rem;
    color: var(--ab-t-6b7cad, #6b7cad);
    padding: .35rem .2rem 0;
}

    .mg-stato b {
        color: var(--ab-t-1e2d5a, #1e2d5a);
        font-weight: 600;
    }

.mg-nota {
    font-size: .78rem;
    color: var(--ab-t-6b7cad, #6b7cad);
}

@media (max-width: 576px) {
    .mg-pagina {
        padding: .5rem;
    }

    .mg-campo {
        flex: 1 1 100%;
    }

        .mg-campo > label {
            min-width: 6.5rem;
        }
}

/* Magazzino - consuntivo distinta base: riquadro dei totali */
.cdb-totali-wrap { overflow-x: auto; max-width: 100%; }
/* un fieldset non si restringe sotto il suo contenuto (min-width: min-content): nelle colonne del magazzino deve poterlo fare */
.mg-colonne > fieldset { min-width: 0; }
.cdb-totali { border-collapse: collapse; }
.cdb-totali th { font-size: .75rem; font-weight: 600; color: var(--bs-secondary-color, var(--ab-t-6c757d, #6c757d)); text-align: right; padding: .1rem .4rem; }
.cdb-totali td { padding: .1rem .4rem; font-size: .82rem; white-space: nowrap; }
.cdb-totali td:first-child { font-weight: 500; }
.cdb-totali .cdb-nota { font-size: .72rem; color: var(--bs-secondary-color, var(--ab-t-6c757d, #6c757d)); font-weight: 400; }
.cdb-totali td:not(:first-child) { font-weight: 600; text-align: right; min-width: 5.5rem; }
.cdb-totali .cdb-rosso { color: var(--ab-t-d32f2f, #d32f2f); }
.cdb-totali .cdb-verde { color: var(--ab-t-2e7d32, #2e7d32); }

/* Magazzino - variazione automatica costanti articoli: righe vecchio/nuovo dato */
.vca-tabella { border-collapse: collapse; }
.vca-tabella th { font-size: .78rem; font-weight: 600; color: var(--bs-secondary-color, var(--ab-t-6c757d, #6c757d)); padding: .2rem .5rem; }
.vca-tabella td { padding: .15rem .5rem; vertical-align: middle; }
.vca-tabella td:first-child { min-width: 16rem; }

/* Toolbar dell'editor "Inserisci nuovo" dentro le finestre di ricerca (rc-modal): lo scorrimento è quello della finestra,
   non della pagina, quindi la barra va agganciata in cima e non sotto top-navbar + barra schede (copriva i titoli). */
.rc-modal .tb2-bar,
.rc-modal .tb-bar { top: 0; }

/* Magazzino - stampa totalizzatori: tendina a spunta dei totalizzatori (come il CheckedComboBoxEdit del legacy) */
.mg-totalizzatori { width: 32rem; max-width: 100%; }
.mg-totalizzatori-elenco { max-height: 18rem; }

/************************************************************
 * INSERIMENTO DOCUMENTI (EmissioneDocumenti: fatture, DDT, prefatture, proforme;
 * EmissioneOrdini: offerte, ordini cliente).
 * Due viste, scelte dal bottone della vista nell'Header (SelettoreVista / VistaSchermoService):
 * .ed-doc--pc  finestra da 1280 px in su (portatile da 15"): testata su due colonne, righe in tabella;
 * .ed-doc--tel smartphone e tablet: una colonna, righe a schede, totale fisso in basso.
 ************************************************************/
.ed-doc { padding: .75rem 1rem 1.5rem; }
.ed-doc--attesa { visibility: hidden; }

.ed-foglio {
    background: var(--ab-s-ffffff, #fff);
    border: 1px solid var(--fe-border);
    border-radius: var(--fe-radius);
    box-shadow: var(--fe-shadow);
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

/* Titoli di sezione: banda azzurra con il blu della ToolbarED per testo e filo a sinistra */
.ed-titolo {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0 0 .65rem;
    padding: .38rem .75rem;
    border: 1px solid var(--ab-b-c8d8f5, #c8d8f5);
    border-left: 4px solid var(--ab-b-1a56db, #1a56db);
    border-radius: 6px;
    background: linear-gradient(135deg, var(--ab-s-dce8ff, #dce8ff) 0%, var(--ab-s-eef4ff, #eef4ff) 100%);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ab-t-1a56db, #1a56db);
}
.ed-titolo .ed-conta { color: var(--fe-text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* Testata: Documento | Pagamento */
.ed-testata { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 2rem; }
.ed-testata > section + section { border-left: 1px solid var(--fe-border); padding-left: 2rem; }

.ed-campo { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: .5rem; margin-bottom: .45rem; }
.ed-campo--doppio { grid-template-columns: 110px minmax(0, 1fr) auto minmax(0, 1fr); }
.ed-lbl { margin: 0; font-size: .8rem; font-weight: 600; color: var(--fe-text-muted); }
.ed-lbl2 { padding-left: .4rem; }
/* Numero e Data del documento in evidenza (richiesta dei tester) */
.ed-lbl--forte { font-weight: 800; color: var(--fe-text); }
.ed-ctrl { min-width: 0; }
.ed-info { margin: -.2rem 0 .45rem calc(110px + .5rem); font-size: .78rem; color: var(--fe-text-muted); }
.ed-info--errore { color: var(--ab-t-dc2626, #dc2626); }
.ed-w-xs { max-width: 90px; }
.ed-w-sm { max-width: 170px; }
.ed-w-md { max-width: 380px; }

/* Campo con pulsante di ricerca accanto (il pulsante non va più a capo) */
.ed-cerca { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ed-cerca > :first-child { flex: 1 1 auto; min-width: 0; }
.ed-lente {
    flex: 0 0 34px;
    align-self: stretch;
    min-height: 31px;
    display: grid;
    place-items: center;
    border: 1.5px solid var(--fe-blue-mid);
    border-radius: 6px;
    background: var(--fe-blue-light);
    color: var(--fe-blue);
    cursor: pointer;
}
.ed-lente:hover { background: var(--fe-blue); border-color: var(--fe-blue); color: var(--ab-t-ffffff, #fff); }

.ed-scad-breve { padding: .35rem .6rem; border-radius: 6px; background: var(--fe-blue-light); font-size: .82rem; color: var(--fe-text); }

/* Griglia di campi con etichetta sopra (spese, DDT, destinatario, dati aggiuntivi) */
.ed-griglia { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem 1rem; }
.ed-cella { display: flex; flex-direction: column; gap: .2rem; min-width: 0; margin: 0; }
.ed-cella > .ed-lbl { font-size: .75rem; }
.ed-cella--2 { grid-column: span 2; }
.ed-cella--tutta { grid-column: 1 / -1; }

/* Righe in tabella (PC) */
.ed-righe-wrap { overflow-x: auto; }
.ed-righe { width: 100%; border-collapse: collapse; }
.ed-righe th {
    padding: .3rem .3rem .4rem;
    border-bottom: 1px solid var(--fe-border);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--fe-text-muted);
    white-space: nowrap;
    text-align: left;
}
.ed-righe td { padding: .3rem; border-bottom: 1px solid var(--fe-border); vertical-align: middle; }
.ed-righe tbody tr:hover { background: var(--fe-blue-light); }
.ed-righe .ed-num { text-align: right; }
.ed-righe .ed-vuota { padding: 1rem; text-align: center; color: var(--fe-text-muted); }
.ed-importo { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ed-righe .fe-descrizione-area { min-height: 31px; height: 31px; resize: vertical; }
/* Descrizione di riga con il pulsante delle descrizioni abituali (Layout documenti) a destra */
.ed-descr-wrap { display: flex; align-items: flex-start; gap: .25rem; }
.ed-descr-wrap > .fe-descrizione-area { flex: 1 1 auto; min-width: 0; }
.ed-descr-wrap > .pr-btn { flex: none; }

/* Righe a schede (telefono) */
.ed-schede { display: flex; flex-direction: column; gap: .7rem; }
.ed-scheda {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
    padding: .6rem .7rem .7rem;
    border: 1px solid var(--fe-border);
    border-radius: 10px;
    background: var(--ab-s-ffffff, #fff);
}
.ed-scheda-testa { grid-column: 1 / -1; display: flex; align-items: center; gap: .4rem; }
.ed-scheda-testa .ed-riga-n { margin-right: auto; font-weight: 700; color: var(--fe-blue); }
.ed-scheda .ed-importo { font-size: 1.05rem; padding-top: .55rem; }
.ed-icona {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--fe-border);
    border-radius: 8px;
    background: var(--ab-s-ffffff, #fff);
    color: var(--fe-text-muted);
}
.ed-icona:disabled { opacity: .35; }
.ed-icona--elimina { color: var(--ab-t-dc2626, #dc2626); }

/* Piede: spese | totali */
.ed-piede {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: 2rem;
    align-items: start;
    padding-top: 1rem;
    border-top: 1px solid var(--fe-border);
}
.ed-totali { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; margin: 0; font-variant-numeric: tabular-nums; }
.ed-totali dt { font-weight: 400; text-align: right; color: var(--fe-text-muted); }
.ed-totali dd { margin: 0; min-width: 90px; text-align: right; color: var(--fe-text); }
.ed-totali .ed-tot-grand { padding-top: .35rem; border-top: 1px solid var(--fe-border); font-size: 1.05rem; font-weight: 700; color: var(--fe-text); }
.ed-totali .ed-tot-netto { font-weight: 700; color: var(--fe-blue); }

/* Sezioni apribili */
/* Sezioni apribili: intestazione a banda blu come .ed-titolo */
.ed-apri + .ed-apri { margin-top: .45rem; }
.ed-apri > summary {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .75rem;
    border: 1px solid var(--ab-b-c8d8f5, #c8d8f5);
    border-left: 4px solid var(--ab-b-1a56db, #1a56db);
    border-radius: 6px;
    background: linear-gradient(135deg, var(--ab-s-dce8ff, #dce8ff) 0%, var(--ab-s-eef4ff, #eef4ff) 100%);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ab-t-1a56db, #1a56db);
    cursor: pointer;
    list-style: none;
}
.ed-apri > summary:hover { background: linear-gradient(135deg, var(--ab-s-cfe0ff, #cfe0ff) 0%, var(--ab-s-e3edff, #e3edff) 100%); }
.ed-apri > summary::-webkit-details-marker { display: none; }
.ed-apri > summary::before { content: "\203A"; width: 14px; font-size: 1.2rem; line-height: 1; color: var(--ab-t-1a56db, #1a56db); transition: transform .15s; }
.ed-apri[open] > summary::before { transform: rotate(90deg); }
.ed-apri .ed-badge { padding: 1px 8px; border-radius: 10px; background: var(--ab-s-ffffff, #ffffff); color: var(--ab-t-1a56db, #1a56db); font-size: .7rem; font-weight: 700; letter-spacing: 0; }
.ed-apri .ed-sub { margin-left: auto; font-size: .78rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--fe-text-muted); }
.ed-apri-corpo { padding: .75rem 0 .9rem; }
.ed-tab { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ed-tab th { padding: .25rem .5rem; border-bottom: 1px solid var(--fe-border); font-size: .7rem; font-weight: 600; text-transform: uppercase; color: var(--fe-text-muted); text-align: left; }
.ed-tab td { padding: .35rem .5rem; border-bottom: 1px solid var(--fe-border); }
.ed-tab .ed-num { text-align: right; }

/* Barra del totale (solo telefono) */
.ed-barra-tot {
    position: sticky;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: .75rem -.5rem 0;
    padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom, 0px));
    background: var(--ab-s-ffffff, #fff);
    border-top: 1px solid var(--fe-border);
    box-shadow: 0 -4px 14px rgba(26, 86, 219, .1);
}
.ed-barra-tot > div { display: flex; flex-direction: column; margin-right: auto; }
.ed-barra-tot span { font-size: .72rem; color: var(--fe-text-muted); }
.ed-barra-tot strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; color: var(--fe-text); }
.ed-barra-tot .pr-btn { min-height: 44px; }

/* Vista PC: campi compatti */
.ed-doc--pc .ed-foglio .form-control,
.ed-doc--pc .ed-foglio .form-select { min-height: 31px; padding: .25rem .5rem; font-size: .875rem; }

/* Vista telefono */
.ed-doc--tel { padding: .5rem .5rem 0; }
.ed-doc--tel .ed-foglio { max-width: 760px; margin: 0 auto; padding: .8rem; gap: .9rem; }
.ed-doc--tel .form-control,
.ed-doc--tel .form-select { min-height: 40px; font-size: 16px; }
.ed-doc--tel .dxbl-text-edit { min-height: 40px; }
.ed-doc--tel .dxbl-text-edit input { font-size: 16px; }
.ed-doc--tel .ed-testata { grid-template-columns: minmax(0, 1fr); gap: .9rem; }
.ed-doc--tel .ed-testata > section + section { border-left: 0; padding-left: 0; border-top: 1px solid var(--fe-border); padding-top: .9rem; }
.ed-doc--tel .ed-campo { grid-template-columns: minmax(0, 1fr); gap: .25rem; margin-bottom: .6rem; }
.ed-doc--tel .ed-campo--doppio { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: .6rem; }
.ed-doc--tel .ed-campo--doppio > .ed-lbl:first-child { grid-row: 1; grid-column: 1; }
.ed-doc--tel .ed-campo--doppio > .ed-lbl2 { grid-row: 1; grid-column: 2; padding-left: 0; }
.ed-doc--tel .ed-campo--doppio > .ed-c1 { grid-row: 2; grid-column: 1; }
.ed-doc--tel .ed-campo--doppio > .ed-c2 { grid-row: 2; grid-column: 2; }
.ed-doc--tel .ed-info { margin-left: 0; }
.ed-doc--tel .ed-w-xs,
.ed-doc--tel .ed-w-sm,
.ed-doc--tel .ed-w-md { max-width: none; }
.ed-doc--tel .ed-lente { flex-basis: 42px; min-height: 40px; }
.ed-doc--tel .ed-griglia { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ed-doc--tel .ed-piede { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.ed-doc--tel .fe-add-btn { width: 100%; justify-content: center; min-height: 44px; }

/* Evasioni e trasformazioni (EvasioneOrdiniCliente/Fornitore, ScaricoRighiOrdini, TrasformaOfferteInOrdini,
   TrasformaDdtInFatture): stessa grafica della maschera documenti, barra tb-bar in alto, filtri e
   parametri nella testata ed-testata, elenco in tabella ed-righe (PC) o a schede vt-* (telefono). */
.ed-scelte { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; min-height: 31px; font-size: .83rem; color: var(--fe-text); }
.ed-scelte label { display: inline-flex; align-items: center; gap: .35rem; margin: 0; cursor: pointer; }
.ed-scelte .form-check-input { margin-top: 0; }
.ed-nota { font-size: .78rem; color: var(--fe-text-muted); }
.ed-righe .ed-riga-gruppo td { background: var(--fe-blue-light); font-size: .82rem; }
.ed-righe .ed-riga-gruppo .ed-sub { margin-left: .5rem; color: var(--fe-text-muted); }
.ed-righe .ed-spunta { width: 32px; }
.ed-righe .ed-input-num { width: 110px; }
.ed-righe .ed-input-num .form-control { text-align: right; }
.ed-righe-wrap--alta { max-height: calc(100vh - 220px); min-height: 360px; overflow: auto; }
.ed-righe-wrap--alta thead th { position: sticky; top: 0; z-index: 1; background: var(--ab-s-ffffff, #fff); }
.ed-tb-azioni { flex-wrap: wrap; justify-content: flex-end; }
.ed-doc--tel .ed-scelte { flex-direction: column; align-items: flex-start; gap: .55rem; }
.ed-doc--tel .ed-scelte label { min-height: 32px; font-size: .95rem; }

@media (prefers-reduced-motion: reduce) {
    .ed-apri > summary::before { transition: none; }
}

/* Barre tb-bar (ToolbarED, ToolbarTabelle) nella vista telefono scelta nell'Header:
   come il @media mobile, anche su uno schermo largo, con pulsanti alti 40px per il tocco */
.tb-bar--tel .tb-inner { padding: .45rem .75rem; gap: .5rem; }
.tb-bar--tel .tb-btn-label { display: none; }
.tb-bar--tel .tb-btn { padding: .42rem .55rem; min-width: 40px; min-height: 40px; justify-content: center; }
.tb-bar--tel .tb-btn i { font-size: 1.05rem; }

/************************************************************
 * ELENCHI A SCHEDE (vista telefono al posto della griglia DevExpress)
 * Struttura: .vt-barra (ricerca, ordinamento) + .vt-schede > .vt-scheda
 *   .vt-scheda-testa (.vt-scheda-titolo + .vt-scheda-importo), .vt-scheda-sub,
 *   .vt-scheda-dati > .vt-dato (span etichetta + valore), .vt-scheda-azioni (pr-btn), .vt-chip.
 * Le aggiunte di una sola pagina vanno nel foglio della sua area (css/vista-*.css).
 ************************************************************/
.vt-barra { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.vt-cerca { flex: 1 1 200px; min-height: 40px; font-size: 16px; }
.vt-barra .form-select { min-height: 40px; font-size: 16px; flex: 0 1 auto; width: auto; }
.vt-conta { font-size: .8rem; color: var(--fe-text-muted); }
.vt-schede { display: flex; flex-direction: column; gap: .6rem; }
.vt-scheda {
    background: var(--ab-s-ffffff, #fff);
    border: 1px solid var(--fe-border);
    border-radius: 10px;
    padding: .65rem .75rem;
    box-shadow: var(--fe-shadow);
}
.vt-scheda--attiva { border-color: var(--fe-blue); box-shadow: 0 0 0 2px var(--fe-blue-mid); }
.vt-scheda--cliccabile { cursor: pointer; }
.vt-scheda-testa { display: flex; align-items: baseline; gap: .5rem; }
.vt-scheda-titolo { margin-right: auto; min-width: 0; font-weight: 700; color: var(--fe-text); overflow-wrap: anywhere; }
.vt-scheda-importo { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--fe-text); }
.vt-scheda-sub { margin-top: .1rem; font-size: .8rem; color: var(--fe-text-muted); overflow-wrap: anywhere; }
.vt-scheda-dati { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem .75rem; margin-top: .45rem; font-size: .84rem; }
.vt-dato { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.vt-dato > span { font-size: .7rem; color: var(--fe-text-muted); }
.vt-dato--tutta { grid-column: 1 / -1; }
.vt-scheda-azioni { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.vt-scheda-azioni .pr-btn,
.vt-scheda-azioni .btn { min-height: 40px; }
.vt-chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .72rem; font-weight: 600; background: var(--fe-blue-light); color: var(--fe-blue); }
.vt-chip--ok { background: var(--ab-s-e7f6ee, #e7f6ee); color: var(--ab-t-0f7b4b, #0f7b4b); }
.vt-chip--attenzione { background: var(--ab-s-fff4e0, #fff4e0); color: var(--ab-t-a35a00, #a35a00); }
.vt-chip--errore { background: var(--ab-s-fdecec, #fdecec); color: var(--ab-t-c0392b, #c0392b); }
.vt-vuoto { padding: 1.5rem; text-align: center; color: var(--fe-text-muted); }
.vt-altri { display: flex; justify-content: center; margin-top: .6rem; }
.vt-altri .pr-btn { min-height: 44px; }

/************************************************************
 * MAGAZZINO - vista telefono (classe .mg-pagina--tel data da MagazzinoPaginaBase.ClasseVista)
 * Campi e gruppi in colonna, etichette sopra, controlli larghi e alti 40px.
 ************************************************************/
.mg-pagina--tel { padding: .5rem; }
.mg-pagina--tel .pr-header { flex-wrap: wrap; gap: .5rem; }
.mg-pagina--tel .pr-header-right { flex-wrap: wrap; gap: .4rem; }
.mg-pagina--tel .mg-colonne { flex-direction: column; }
.mg-pagina--tel .mg-colonne > * { flex: 1 1 auto; }
.mg-pagina--tel .mg-griglia-layout { grid-template-columns: minmax(0, 1fr); }
.mg-pagina--tel .mg-riga { flex-direction: column; align-items: stretch; gap: .55rem; }
.mg-pagina--tel .mg-campo { flex: 1 1 auto; flex-wrap: wrap; width: 100%; }
.mg-pagina--tel .mg-campo > label { flex: 0 0 100%; min-width: 0; white-space: normal; }
.mg-pagina--tel .mg-campo .form-control,
.mg-pagina--tel .mg-campo .form-select { flex: 1 1 0; width: auto !important; max-width: none !important; min-height: 40px; font-size: 16px; }
.mg-pagina--tel .mg-campo .pr-btn--icona { min-width: 40px; min-height: 40px; }
.mg-pagina--tel .mg-check { min-height: 32px; font-size: .9rem; }
