/* ============================================ */
/* ORDINI CLIENTI                               */
/* ============================================ */
/* La finestra di dettaglio usa .modal (10000) come le altre e sta
   PRIMA del pop-up di avviso nella pagina, quindi l'avviso resta sopra.
   Riusa i colori dei quadratini di macchine.css */

.ord-filtri {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ord-filtri select {
    margin-bottom: 8px;
}

/* Elenco */
.ord-table tr.ord-riga-click {
    cursor: pointer;
}

.ord-table tr.ord-riga-click:hover td {
    background: var(--light);
}

.ord-col-articoli {
    font-size: 12px;
    max-width: 420px;
    white-space: normal !important;
}

.ord-col-totale {
    text-align: right;
    white-space: nowrap;
    font-weight: 700;
}

.ord-annullato {
    opacity: 0.55;
}

.ord-annullato td:nth-child(3),
.ord-annullato .ord-card-cliente {
    text-decoration: line-through;
}

.ord-stato {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.mac-quadro.st-annullato {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.ord-card {
    border: 2px solid var(--green-light);
    border-radius: var(--border-radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
    background: white;
    cursor: pointer;
}

.ord-card-top,
.ord-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.ord-card-cliente {
    font-family: 'Roboto Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--mac-penna);
    margin: 2px 0;
}

.ord-card-articoli {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 6px;
}

/* Modulo */
.ord-modulo textarea {
    resize: vertical;
}

@media (min-width: 769px) {
    .ord-due {
        grid-template-columns: 1fr 1fr;
        gap: 0 12px;
    }
}

.ord-sottotitolo {
    color: var(--primary);
    font-size: 16px;
    margin: 10px 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary);
}

.ord-riga-form {
    border: 2px solid var(--green-light);
    border-radius: var(--border-radius-sm);
    padding: 8px 10px 4px;
    margin-bottom: 8px;
    background: white;
}

.ord-riga-libera {
    border-style: dashed;
}

.ord-riga-campi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 8px;
    align-items: end;
    position: relative;
    padding-right: 40px;
}

.ord-campo label {
    font-size: 11px;
    margin-bottom: 3px;
    color: var(--gray);
}

.ord-campo input,
.ord-campo select {
    margin-bottom: 6px;
    padding: 9px;
    font-size: 14px;
}

.ord-campo-descr {
    grid-column: 1 / -1;
}

.ord-togli {
    position: absolute;
    top: 18px;
    right: 0;
}

@media (min-width: 769px) {
    .ord-riga-campi {
        grid-template-columns: 3fr 1.2fr 0.6fr 1fr 1.2fr;
    }
    .ord-campo-descr {
        grid-column: auto;
    }
}

.ord-libera {
    display: block;
    font-size: 12px;
    color: var(--gray);
    padding: 11px 0 12px;
}

.ord-riga-info {
    font-size: 11px;
    color: var(--gray);
    margin: 0 0 6px;
    line-height: 1.5;
}

.ord-riga-poche {
    color: #b45309;
    font-weight: 700;
}

.ord-aggiungi {
    margin-top: 6px;
}

.ord-aggiungi-pulsanti {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    margin-bottom: 8px;
}

.ord-aggiungi-pulsanti .btn-back {
    width: auto;
}

.ord-aggiungi-pulsanti .mac-link {
    margin: 0;
}

.ord-totale-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #688E53;
    color: white;
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    margin: 12px 0 16px;
    font-weight: 700;
}

.ord-totale-box strong {
    font-size: 20px;
}

/* Firma */
.ord-firma-box {
    position: relative;
    border: 2px dashed #94a3b8;
    border-radius: var(--border-radius-sm);
    background: #fcfcfd;
    height: 170px;
    margin-bottom: 14px;
}

.ord-firma-box.firmata {
    border-style: solid;
    border-color: var(--primary);
}

#ord-firma,
#ord-firma2 {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: crosshair;
    z-index: 1;
}

.ord-firma-segno {
    position: absolute;
    left: 14px;
    bottom: 34px;
    right: 14px;
    border-bottom: 1px solid #cbd5e1;
    color: #94a3b8;
    font-size: 14px;
    pointer-events: none;
}

#ord-firma-cancella,
#ord-firma2-cancella {
    position: absolute;
    right: 8px;
    bottom: 6px;
    z-index: 2;
}

.ord-pulsanti {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
}

.ord-pulsanti .btn-secondary {
    font-size: 14px;
    padding: 12px 18px;
}

/* Dettaglio */
.ord-det-testa {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.ord-det-cliente {
    font-family: 'Roboto Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--mac-penna);
}

.ord-det-dati {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    font-size: 13px;
    margin-bottom: 12px;
}

.ord-det-dati span {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--gray);
}

.ord-det-riga {
    border-top: 1px solid #e5e7eb;
    padding: 8px 0;
    font-size: 13px;
}

.ord-det-riga-testa {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.ord-det-riga-testa small {
    color: var(--gray);
}

.ord-det-pezzi {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
}

.ord-det-pezzo {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px 6px;
}

.ord-det-pezzo small {
    margin-left: 4px;
    color: var(--gray);
}

.ord-det-libera {
    font-size: 11px;
    color: var(--gray);
    margin-top: 3px;
}

.ord-det-totale {
    display: flex;
    justify-content: space-between;
    border-top: 2px solid var(--primary);
    padding: 8px 0;
    font-weight: 700;
    font-size: 15px;
}

.ord-det-firma {
    margin: 6px 0 10px;
    font-size: 11px;
    color: var(--gray);
}

.ord-det-firma img {
    display: block;
    max-width: 100%;
    height: 90px;
    object-fit: contain;
    object-position: left;
    border-bottom: 1px solid #cbd5e1;
}

.ord-azioni {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.ord-azioni .btn-back,
.ord-azioni .btn-primary,
.ord-azioni .btn-danger {
    width: 100%;
    white-space: normal;
}

/* ============================================ */
/* STAMPA ORDINE (come il modulo cartaceo)       */
/* ============================================ */
#ordine-print {
    display: none;
}

@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    body.stampa-ordine > *:not(#ordine-print) {
        display: none !important;
    }

    body.stampa-ordine {
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
    }

    body.stampa-ordine #ordine-print {
        display: block !important;
    }

    body.stampa-ordine #ordine-print,
    body.stampa-ordine #ordine-print * {
        visibility: visible !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

.ost-pagina {
    position: relative;
    font-family: Arial, Helvetica, sans-serif;
    color: #111;
    font-size: 13px;
    width: 100%;
}

/* Altezza utile del foglio (A4 con margini 10 mm): serve all'app per
   calcolare quante righe vuote aggiungere alla tabella articoli */
.ost-pagina.ost-a4-pdf {
    width: 718px;
}

.ost-testa {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.ost-logo {
    height: 78px;
    max-width: 48%;
    object-fit: contain;
    object-position: left center;
}

.ost-azienda {
    border: 1px solid #555;
    padding: 7px 12px;
    font-size: 12.5px;
    line-height: 1.45;
    min-width: 46%;
}

.ost-riga-tipo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 14px;
}

.ost-data {
    min-width: 40%;
    border-bottom: 1px solid #777;
}

.ost-casella {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border: 1.5px solid #222;
    margin-right: 5px;
    font-size: 12px;
    line-height: 1;
    vertical-align: middle;
}

.ost-linea {
    display: flex;
    align-items: baseline;
    gap: 8px;
    border-bottom: 1px solid #777;
    padding: 5px 0 2px;
    min-height: 24px;
}

.ost-etich {
    font-weight: 700;
    font-size: 11.5px;
    flex: 0 0 auto;
}

.ost-val {
    font-size: 14px;
}

.ost-doppia {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ost-box {
    border: 1px solid #5a7d3a;
    margin: 10px 0;
}

.ost-box-testa {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #5a7d3a;
    color: white;
    font-weight: 700;
    padding: 3px 8px;
    font-size: 13px;
}

.ost-piccolo {
    font-size: 9.5px;
}

.ost-box-corpo {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 14px;
}

.ost-tabella {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.ost-tabella th {
    background: #5a7d3a;
    color: white;
    text-align: left;
    font-size: 13px;
    padding: 4px 6px;
}

.ost-tabella th:nth-child(1) { width: 56%; }
.ost-tabella th:nth-child(2) { width: 18%; }
.ost-tabella th:nth-child(3) { width: 8%; }
.ost-tabella th:nth-child(4) { width: 18%; }

/* Righe strette come sul blocchetto (si aggiungono righe vuote fino a riempire il foglio) */
.ost-tabella td {
    border: 1px solid #9aa7a0;
    padding: 2px 6px;
    height: 24px;
    font-size: 13.5px;
    vertical-align: middle;
    word-wrap: break-word;
}

.ost-tabella td em {
    font-size: 10.5px;
    color: #555;
}

.ost-c { text-align: center !important; }
.ost-r { text-align: right !important; }

.ost-piede {
    display: grid;
    grid-template-columns: 1fr 260px;
    align-items: stretch;
}

.ost-caselle {
    display: flex;
    gap: 40px;
    align-items: center;
    font-size: 13px;
}

.ost-totale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #a7bf8f;
    padding: 6px 8px;
    font-weight: 700;
    font-size: 14px;
}

.ost-condizioni {
    font-size: 8.5px;
    line-height: 1.35;
    margin: 8px 0 12px;
    text-align: justify;
}

.ost-firma {
    margin-left: auto;
    width: 50%;
    text-align: center;
    font-size: 10.5px;
    font-weight: 700;
}

.ost-firma img {
    display: block;
    height: 60px;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
}

.ost-firma-vuota {
    height: 60px;
}

.ost-firma span {
    display: block;
    border-top: 1px solid #555;
    padding-top: 3px;
}

.ost-annullato {
    position: absolute;
    top: 40%;
    left: 10%;
    right: 10%;
    text-align: center;
    font-size: 64px;
    font-weight: 700;
    color: rgba(220, 38, 38, 0.25);
    border: 6px solid rgba(220, 38, 38, 0.25);
    transform: rotate(-18deg);
}

/* Operatore */
.ord-operatore {
    color: var(--gray);
    font-weight: 600;
}

/* Operatore accanto al numero d'ordine */
.ost-operatore {
    margin-left: 28px;
}

/* PDF su Drive (riga nel dettaglio) */
.ord-drive {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius-sm);
    padding: 8px 10px;
    font-size: 12px;
    line-height: 2;
    margin-top: 8px;
    word-break: break-word;
}

.ord-drive .mac-btn-piccolo {
    text-decoration: none;
    margin-left: 4px;
    line-height: 1.2;
}

/* Contenitore temporaneo per creare il PDF (fuori dallo schermo) */
.ord-pdf-temp {
    position: fixed;
    left: -10000px;
    top: 0;
    width: 760px;
    background: white;
    padding: 0;
    z-index: -1;
}

/* ============================================ */
/* PDF ORDINE NELLO STILE DEI REPORT (rpt-*)    */
/* Gli stili rpt-* sono in macchine.css          */
/* ============================================ */
.pdf-foglio.pdf-misura {
    left: -10000px;
    visibility: hidden;
}

.ordd {
    position: relative;
    font-size: 11px;
}

.ordd .rpt-testa-logo {
    width: 45%;
}

.ordd .rpt-logo.ordd-logo {
    height: 88px;
    max-width: 100%;
}

.ordd .rpt-titolo {
    font-size: 17px;
}

.ordd .rpt-sotto {
    font-size: 9.5px;
}

/* Data dell'ordine piu' grande (si vedeva poco) */
.ordd .rpt-sotto.ordd-data {
    font-size: 14px;
    margin-top: 4px;
}

.ordd .rpt-sotto strong {
    color: #1f2937;
}

.ordd-casella {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1.3px solid #1f2937;
    font-size: 10px;
    line-height: 11px;
    text-align: center;
    vertical-align: middle;
    margin-right: 3px;
    color: #1f2937;
}

.ordd-dati {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.ordd-dati td {
    padding: 5px 6px 3px;
    border-bottom: 1px solid #d1d5db;
    vertical-align: bottom;
}

.ordd-etich {
    width: 13%;
    font-size: 8.5px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.ordd-val {
    font-size: 12px;
    color: #111827;
}

.ordd-nota-sezione {
    float: right;
    font-size: 8.5px;
    font-weight: 400;
    color: #6b7280;
    margin-top: 2px;
}

.ordd-box {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
}

.pdf-foglio .ordd-righe th {
    font-size: 9.5px !important;
}

.pdf-foglio .ordd-righe td {
    font-size: 11px !important;
    height: 21px !important;
    padding: 2px 6px !important;
    vertical-align: middle;
}

.pdf-foglio .ordd-righe tbody tr:nth-child(even) td {
    background: white;
}

.ordd-matr {
    font-size: 9px;
    color: #4b5563;
    margin-top: 1px;
}

.ordd-mag {
    font-size: 9.5px !important;
    color: #4b5563;
}

.pdf-foglio .ordd-righe tfoot td {
    font-size: 11px !important;
    padding: 6px !important;
}

.ordd-caselle {
    font-weight: 400;
    color: #1f2937;
    background: white !important;
}

.ordd-tot-etich {
    text-align: right;
}

.pdf-foglio .ordd-righe .ordd-tot {
    font-size: 13px !important;
}

.ordd-condizioni {
    font-size: 7.5px;
    line-height: 1.35;
    color: #4b5563;
    text-align: justify;
    margin: 8px 0 10px;
}

.ordd-firme {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.ordd-firme td {
    vertical-align: bottom;
    padding: 0;
}

.ordd-firme-sx {
    width: 50%;
}

.ordd-firma {
    text-align: center;
}

.ordd-firma img {
    display: block;
    height: 58px;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
}

.ordd-firma-vuota {
    height: 58px;
}

.ordd-firma-linea {
    border-top: 1px solid #6b7280;
    padding-top: 3px;
    font-size: 8.5px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ============================================ */
/* BOZZA ORDINE DAL LISTINO                     */
/* ============================================ */
.ord-bozza {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    background: #ecfdf5;
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 10px 14px;
    margin: 0 0 12px 0;
    font-size: 13px;
}
.ord-bozza.hidden { display: none; }
#ord-bozza-banner { margin-top: 12px; }
.ord-bozza-testo { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.ord-bozza-pulsanti { display: flex; gap: 8px; flex-wrap: wrap; }
.ord-bozza-pulsanti .mac-btn-piccolo { width: auto; }

/* Carrello sulle righe del listino */
.listino-bozza-btn {
    background: white;
    border: 2px solid var(--primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 5px 8px;
    margin-right: 4px;
}
.listino-bozza-btn:hover { background: #dcfce7; }
.listino-table td.listino-col-azioni { white-space: nowrap; }

/* Avviso breve "aggiunta alla bozza": sopra il contenuto, sotto le finestre modali (10000) */
.ord-bozza-avviso {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 20px);
    background: #14532d;
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 5000;
    max-width: calc(100vw - 32px);
}
.ord-bozza-avviso.visibile { opacity: 1; transform: translate(-50%, 0); }

/* ============================================ */
/* SCELTA DELLA MACCHINA / MATRICOLA NELL'ORDINE */
/* ============================================ */
.ord-matricole {
    margin-top: 6px;
    padding: 8px 10px;
    border: 2px solid #f59e0b;
    background: #fffbeb;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.ord-matricole.ord-matricole-ok { border-color: var(--primary); background: #f0fdf4; }
.ord-matricole-testa { width: 100%; font-size: 12px; font-weight: 700; }
.ord-matricole-testa small { font-weight: 400; }
.ord-matricole-vuoto { font-size: 12px; color: #92400e; }
.ord-matr {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.2;
}
.ord-matr input { width: auto; margin: 0; }
.ord-matr small { color: #64748b; }
.ord-matr-num { font-weight: 700; }
.ord-matr.scelta { border-color: var(--primary); background: #dcfce7; }
.mac-picker-matr .mac-picker-attrezzo { color: #1d4ed8; }

/* ============================================ */
/* ORDINE SENZA SERVIZIO DI INSTALLAZIONE       */
/* ============================================ */
.ord-check-noinst {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 14px 0 6px;
    padding: 10px 12px;
    border: 2px dashed #f59e0b;
    border-radius: 10px;
    background: #fffbeb;
    cursor: pointer;
    font-weight: 400;
}
.ord-check-noinst input { width: auto; margin-top: 3px; }
.ord-installazione {
    border: 2px solid #f59e0b;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
    background: #fffdf5;
}
.ord-installazione.hidden { display: none; }
.ord-installazione-testo { font-size: 12px; line-height: 1.45; margin: 0 0 10px; text-align: justify; }
.ord-badge-noinst {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    vertical-align: middle;
}
.ord-det-noinst {
    margin-top: 10px;
    padding: 10px;
    border: 2px solid #f59e0b;
    border-radius: 10px;
    background: #fffbeb;
}

/* PDF: dichiarazione dentro il riquadro dell'ordine, sopra Disponibile / Totale (riquadro verde come la commissione robot) */
.pdf-foglio .ordd-righe tr.ordd-noinst > td,
.ordd-righe tr.ordd-noinst > td {
    height: auto !important;
    padding: 0 !important;
    white-space: normal !important;
    background: #fff;
    border: 2px solid #5a7d3a !important;
}
.ordd-noinst-tab { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pdf-foglio .ordd-righe .ordd-noinst-tab td,
.ordd-noinst-tab td { border: none !important; vertical-align: middle; }
.pdf-foglio .ordd-righe .ordd-noinst-casella,
.ordd-noinst-casella { width: 26px; padding: 8px 0 8px 8px !important; vertical-align: top !important; }
.pdf-foglio .ordd-righe .ordd-noinst-testo,
.ordd-noinst-testo {
    width: 60%;
    font-size: 8.5px !important;
    line-height: 1.4 !important;
    color: #1f2937;
    text-align: justify;
    padding: 8px 12px 8px 6px !important;
    vertical-align: top !important;
    font-weight: 400 !important;
}
.ordd-noinst-testo strong { font-weight: 700; color: #3f5a2c; text-transform: uppercase; letter-spacing: 0.3px; }
.pdf-foglio .ordd-righe .ordd-noinst-firma,
.ordd-noinst-firma { padding: 6px 8px 4px !important; vertical-align: bottom !important; }
@media (max-width: 768px) {
    .ord-installazione-testo { text-align: left; }
}

/* Data + Operatore: su iPad/iPhone (Safari) il campo data e' piu' largo della sua colonna e copriva l'operatore.
   Colonne che possono stringersi + campo data senza la grafica di sistema; operatore piu' stretto. */
@media (min-width: 769px) {
    .ord-due { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .ord-riga-data { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}
.ord-due .form-col { min-width: 0; }
.ord-modulo input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    text-align: left;
}
.ord-modulo input[type="date"]::-webkit-date-and-time-value { text-align: left; }

/* ============================================ */
/* SCONTO SUL TOTALE                            */
/* ============================================ */
.ord-sconto-riga { margin-top: 14px; max-width: 420px; }
.ord-totale-dettaglio {
    margin: 12px 0 -8px;
    padding: 8px 14px;
    border: 1px solid #c7d7bd;
    border-bottom: none;
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
    background: #f3f7f0;
    font-size: 13px;
}
.ord-totale-dettaglio.hidden { display: none; }
.ord-totale-dettaglio > div { display: flex; justify-content: space-between; padding: 2px 0; }
.ord-sconto-errore { color: #b91c1c; font-weight: 700; }
.ord-det-sconto { display: flex; justify-content: space-between; padding: 2px 4px; font-size: 13px; color: #374151; }
.pdf-foglio .ordd-righe tr.ordd-sconto td { font-weight: 400 !important; padding-top: 3px !important; padding-bottom: 3px !important; }

/* ---------- Pagamento: acconto e timbro PAGATO ---------- */
.ord-pagamento-riga { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.ord-pagamento-riga .ord-acconto { max-width: 220px; }
.ord-pagamento-riga .ord-metodo { min-width: 190px; }
.ord-pagamento-riga .ord-metodo select { width: 100%; }
.ord-pagamento-riga .ord-check-pagato { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 0 0 8px; }
.ord-pagamento-riga .ord-check-pagato input { width: 20px; height: 20px; }
.ord-det-saldo { display: flex; justify-content: space-between; padding: 2px 4px; font-size: 13px; color: #374151; }
.ord-det-saldo.ord-da-saldare { font-weight: 700; color: #b45309; font-size: 14px; }
.ord-badge-pagato { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 10px; background: #dcfce7; color: #166534; font-size: 12px; font-weight: 700; border: 1px solid #86efac; }
.pdf-foglio .ordd-righe tr.ordd-acconto td { font-weight: 400 !important; padding-top: 3px !important; padding-bottom: 3px !important; }
.pdf-foglio .ordd-righe tr.ordd-saldo td { font-weight: 700 !important; }
/* Totali: le caselle Disponibile / Da ordinare stanno in una sola cella a sinistra, in basso */
.pdf-foglio .ordd-righe td.ordd-caselle-blocco { vertical-align: bottom !important; border-bottom: none !important; }
.ordd-metodo-riga { margin-top: 4px; font-size: 10.5px; }
.ordd-metodo-riga strong { color: #1f2937; }
.ordd-tot-metodo { display: block; font-size: 8.5px; font-weight: 400; color: #4b5563; }
/* Timbro PAGATO: grande, al centro del corpo dell'ordine (sopra la tabella articoli) */
.ordd-righe-wrap { position: relative; }
.ordd-timbro-box {
    position: absolute;
    left: 0;
    right: 0;
    top: 34%;
    text-align: center;
    pointer-events: none;
}
.ordd-timbro { display: inline-block; width: 150px; transform: rotate(-12deg); opacity: 0.85; }
.ordd-timbro-testo {
    display: inline-block;
    margin: 0;
    padding: 6px 22px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(22, 128, 61, 0.85);
    border: 4px solid rgba(22, 128, 61, 0.85);
    border-radius: 8px;
    transform: rotate(-10deg);
}

/* Riga gia' salvata di un ordine in modifica: cosa c'e' gia' nell'ordine */
.ord-riga-gia {
    color: #1e3a8a;
    background: #eff6ff;
    border-radius: 6px;
    padding: 4px 8px;
}

/* Montata pronta all'uso / In scatola (riquadrini sotto la riga del modulo) */
.ord-montaggio {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 6px;
}

.ord-mont {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    margin: 0;
    cursor: pointer;
    background: white;
}

.ord-mont input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.ord-mont.scelta {
    border-color: var(--primary);
    background: #f0fdf4;
}

.ord-tag-mont {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    padding: 1px 6px;
    margin-left: 4px;
}

.ord-tag-montata { background: #fef3c7; color: #92400e; }
.ord-tag-scatola { background: #e0e7ff; color: #3730a3; }
