/**
 * Compattezza globale — tutti i moduli (telefono / tablet / desktop).
 * Caricato per ultimo da base.html: i campi corti non devono copiare la larghezza della card.
 */
html { overflow-x: clip; }
body, main { min-width: 0; max-width: 100%; }

[hidden] { display: none !important; }

/* File nativo: mai riga a tutta pagina */
input[type="file"] {
    width: auto !important;
    max-width: min(100%, 16rem);
    flex: 0 0 auto;
}

/* Dati corti: larghezza ≈ contenuto */
input[type="number"],
input[type="date"],
input[type="month"],
input[type="week"],
input[type="time"],
input[type="datetime-local"] {
    width: auto;
    min-width: 4.8em;
    max-width: 100%;
}

input[inputmode="numeric"],
input[inputmode="decimal"] {
    width: auto;
    max-width: 8.5rem;
}

input[maxlength="1"],
input[maxlength="2"] { width: 3.4em; max-width: 100%; }
input[maxlength="3"] { width: 4.4em; max-width: 100%; }
input[maxlength="4"] { width: 5.6em; max-width: 100%; }
input[maxlength="5"] { width: 6.4em; max-width: 100%; }
input[maxlength="6"] { width: 7.2em; max-width: 100%; }
input[maxlength="8"] { width: calc(8ch + 1.2rem); max-width: 100%; }

/* Righe ordine: i numerici restano nella colonna stretta, non 8.5rem */
.od-tbl-lines input[inputmode="decimal"],
.od-tbl-lines input.num,
.fic-line .gp-field input[inputmode="decimal"],
.fic-line .gp-field input[inputmode="numeric"],
.fic-line .gp-field input,
.fic-line .gp-field select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.gp-field--xs { width: 5.6rem; flex: 0 0 5.6rem; max-width: 100%; }
.gp-field--sm { width: 7.2rem; flex: 0 0 7.2rem; max-width: 100%; }
.gp-field--md { width: 11rem; flex: 0 0 11rem; max-width: 100%; }
.gp-field--fill { flex: 1 1 12rem; min-width: min(100%, 12rem); }
.gp-field--fill input,
.gp-field--fill select,
.gp-field--fill textarea { width: 100%; }

.gp-form-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: flex-end;
}
.gp-form-grid .gp-field {
    flex: 1 1 11rem;
    max-width: 100%;
    min-width: 0;
}
.gp-form-grid .gp-field-full,
.gp-field-full {
    flex: 1 1 100%;
    width: 100%;
}
.gp-form-grid .gp-field.gp-field--fill { flex: 1 1 14rem; width: auto; min-width: min(100%, 10rem); }
.gp-form-grid .gp-field.gp-field--vat { flex: 0 0 12.5rem; width: 12.5rem; }
.gp-form-grid .gp-field.gp-field--cf { flex: 0 0 15rem; width: 15rem; }
.gp-form-grid .gp-field.gp-field--tel { flex: 0 0 12rem; width: 12rem; }
.gp-form-grid .gp-field.gp-field--cap { flex: 0 0 6.4rem; width: 6.4rem; }
.gp-form-grid .gp-field.gp-field--prov { flex: 0 0 4.6rem; width: 4.6rem; }
.gp-form-grid .gp-field.gp-field--iso { flex: 0 0 4.2rem; width: 4.2rem; }
.gp-form-grid .gp-field.gp-field--country {
    flex: 0 0 4.6rem;
    width: 4.6rem;
    max-width: 4.6rem;
}
.gp-form-grid .gp-field.gp-field--country input {
    width: 4.2em;
    max-width: 100%;
}
.gp-form-grid.cli-ana .cli-ana-ids {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px 10px;
    flex: 1 1 16rem;
    min-width: 0;
    width: auto;
    align-items: flex-end;
}
.gp-form-grid.cli-ana .cli-ana-ids .gp-field--vat,
.gp-form-grid.cli-ana .cli-ana-ids .gp-field--cf {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: none;
}
.gp-form-grid.cli-ana .cli-ana-ids .gp-field input { width: 100%; }
.gp-form-grid.cli-ana .cli-ana-pay {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    flex: 1 1 100%;
    width: 100%;
    align-items: flex-end;
}
.gp-form-grid.cli-ana .cli-ana-pay .ot-pay {
    flex: 1 1 12rem;
    width: auto;
    min-width: min(100%, 10rem);
}
.gp-form-grid.cli-ana .cli-ana-pay .ot-metodo {
    flex: 0 0 5.2rem;
    width: 5.2rem;
}
.gp-form-grid--wide .gp-field { flex: 1 1 100%; }

/* Toolbar / filtri: non stirare i controlli */
.fic-origine,
.fic-copy-bar,
.fic-copy-fic,
.fic-copy-pgp,
.gp-form-actions,
.ord-fic-bar,
#docs-card .ord-fic-bar,
.gp-page-header,
.ol-filters,
.toolbar,
.gs-main-toolbar,
.gs-mrow-tools,
.gp-year-bar,
.gp-doc-filters {
    flex-wrap: wrap;
}

.gp-field input[type="search"],
.gp-field input[type="email"],
.gp-field input[type="url"],
.gp-field textarea {
    width: 100%;
    max-width: 100%;
}
.gp-doc-filters .gp-field--sm input[type="search"] {
    width: 7.2rem;
    max-width: 7.2rem;
    flex: 0 0 auto;
}
.gp-doc-eye {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
}
.ol-page .ol-pdf-eye {
    width: 26px;
    height: 26px;
}
.ol-page .ol-fic-clip {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
}

/* Schermi stretti e tablet touch */
@media (max-width: 900px), (max-width: 1100px) and (pointer: coarse) {
    .gp-page,
    .page,
    .wrap {
        padding-left: 10px;
        padding-right: 10px;
    }

    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]),
    select,
    textarea {
        font-size: 16px;
        min-height: 40px;
        max-width: 100%;
    }

    .gp-btn,
    button.gp-btn,
    .sped-btn-lg,
    .od-btn,
    .dbtn {
        min-height: 40px;
    }

    .cli-sped-nome-lbl {
        min-height: 40px;
        align-items: center;
    }
    .cli-sped-nome-lbl input[type="checkbox"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
    }

    .fic-origine-opt { flex: 1 1 auto; justify-content: center; }

    .fic-add-btn,
    .fic-act { flex: 0 0 auto; width: auto; max-width: 100%; }

    .gp-docs-eye { flex: 0 0 auto; width: 40px; height: 40px; }
    .ol-page .ol-pdf-eye { flex: 0 0 auto; width: 28px; height: 28px; }
    .ol-page .ol-doc-btn { flex: 0 0 auto; min-height: 18px; height: 18px; min-width: 28px; padding: 0 4px; }
    .ol-page .ol-dett-btn { flex: 0 0 auto; min-height: 28px; height: 28px; }
    .ol-page .ol-fic-clip { flex: 0 0 auto; width: 28px; height: 28px; }
    .ol-page a.ol-ship-track,
    .ol-page a.ol-fic-doc {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        padding: 0 8px;
    }
    .gp-awb-val .gp-awb-chip,
    .gp-page--ord .gp-awb-val .gp-awb-chip,
    .gp-page--ord .f-ship-status {
        height: 40px;
        min-height: 40px;
        font-size: 16px;
    }

    table { max-width: none; }
}

/* Testata ordine: niente colonna Totale, spazio ai dati */
.gp-page--ord {
    max-width: 1280px;
    padding-bottom: 4.2rem;
}
.gp-page--ord .fic-layout {
    display: block;
    grid-template-columns: none;
    gap: 0;
}
.gp-page--ord .gp-card--soft,
.gp-page--ord .gp-card {
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 10px;
}
.gp-page--ord .gp-card h2,
.gp-page--ord .fic-list-head h2 {
    margin: 0 0 8px;
    font-size: 0.95rem;
}
.fic-start-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}
.fic-start-row h2 { margin: 0; }
.gp-page--ord .fic-origine-opt { padding: 6px 12px; }
.gp-page--ord .fic-copy-panel { margin-top: 8px; }
.gp-page--ord .cli-panel,
.gp-page--ord .cli-change,
.gp-page--ord .gp-combo,
.gp-page--ord .gp-field--name {
    overflow: visible;
}
.gp-page--ord .cli-panel {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
}
.gp-page--ord .cli-addr-grid { margin-top: 8px; gap: 8px; }
.gp-page--ord .cli-addr { padding: 8px 10px; border-radius: 8px; }
.gp-page--ord .cli-name { font-size: 1.05rem; }
.gp-page--ord .od-hint { margin: 0 0 6px; font-size: 12px; }
.gp-page--ord .cli-sped-nome { margin: 4px 0 8px; padding: 6px 8px; }
.gp-page--ord .gp-field input,
.gp-page--ord .gp-field select,
.gp-page--ord .gp-field textarea {
    padding: 7px 9px;
}
.ord-save-bar {
    position: sticky;
    bottom: 0;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 0 6px;
    background: linear-gradient(transparent, #f7f7f8 32%);
}
.ord-save-bar .fic-finalizza,
.ord-save-bar .gp-btn {
    width: auto;
    min-width: 8.5rem;
    margin-top: 0;
    min-height: 40px;
    justify-content: center;
}
.ord-save-bar .gp-btn-danger {
    margin-right: auto;
}

.ord-ddt {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}
.ord-ddt h3 {
    margin: 0 0 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
}
.gp-form-grid.ord-ddt-grid {
    gap: 12px 14px;
    align-items: flex-end;
}
.gp-form-grid.ord-ddt-grid > .gp-field {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    max-width: 100%;
}
.gp-form-grid.ord-ddt-grid > .gp-field--xs { width: 5.6rem; flex: 0 0 5.6rem; }
.gp-form-grid.ord-ddt-grid > .gp-field--sm { width: 7.2rem; flex: 0 0 7.2rem; }
.gp-form-grid.ord-ddt-grid > .gp-field--md { width: 11rem; flex: 0 0 11rem; }
.gp-form-grid.ord-ddt-grid > .gp-field--fill {
    flex: 1 1 10rem;
    width: auto;
    min-width: min(100%, 10rem);
}
.gp-form-grid.ord-ddt-grid input,
.gp-form-grid.ord-ddt-grid select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
#ddt_causale_libero { margin-top: 6px; width: 100%; }
.cli-ana { margin: 0; }
.gp-form-grid .gp-field.gp-field--sdi {
    flex: 0 0 6.4rem;
    width: 6.4rem;
}
.fic-list-head--po {
    align-items: center;
}
.fic-list-head--po .ot-po {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    flex: 0 0 auto;
    margin: 0;
    width: auto;
    max-width: 100%;
    overflow: visible;
}
.fic-list-head--po .ot-po label {
    margin: 0;
    white-space: nowrap;
}
.od-po-ref {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 6px 8px;
    flex: 0 0 auto;
    max-width: 100%;
}
.od-po-ref .od-f-tipo,
.od-po-ref .od-po-combo {
    flex: 0 0 auto;
    position: relative;
    width: auto;
    overflow: visible;
}
.gp-page--ord .gp-field .od-po-ref .od-f-tipo input.od-po-tipo,
.od-campi .od-po-ref .od-f-tipo input.od-po-tipo,
.usc-po-row .od-po-ref .od-f-tipo input.od-po-tipo,
.od-po-ref .od-f-tipo select,
.od-po-ref .od-f-tipo input.od-po-tipo {
    width: 4.75rem;
    min-width: 4.4rem;
    max-width: 4.75rem;
    font-weight: 700;
    padding-right: 1.7em;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2364748b' d='M1.2 1.5 6 6.3 10.8 1.5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.55em center;
    background-size: 10px 7px;
    cursor: pointer;
}
.od-po-tipo::-webkit-calendar-picker-indicator,
.od-po-tipo::-webkit-list-button {
    display: none !important;
}
.od-po-tipo-list {
    min-width: 7rem;
    left: auto;
    right: auto;
    z-index: 80;
}
.od-po-tipo-list button {
    font-weight: 700;
    min-height: 40px;
}
.od-po-ref .od-f-po {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 100%;
}
.od-po-ref .od-f-po input,
.fic-list-head--po .ot-po .od-po-ref .od-f-po input,
.gp-page--ord .fic-list-head--po .ot-po .od-f-po input,
.od-campi .od-po-ref .od-f-po input,
.gp-uscita .od-po-ref .od-f-po input,
.usc-po-row .od-po-ref .od-f-po input {
    width: calc(48ch + 1.2rem);
    max-width: 100%;
    flex: 0 0 auto;
}
.od-campi .od-po-ref {
    width: auto;
    flex: 0 0 auto;
}
.usc-po-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin: 0 0 10px;
}
.usc-po-row .od-po-ref { margin: 0; }
.usc-po-save {
    flex: 0 0 auto;
    min-height: 40px;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.ord-job-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.ord-job-chip {
    display: inline-flex;
    align-items: center;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
}
@media (max-width: 900px), (max-width: 1100px) and (pointer: coarse) {
    .cli-head-actions .gp-btn { min-height: 40px; }
    .ord-ddt-grid select,
    .cli-ana input,
    .cli-ana select,
    .pt-assist-input { font-size: 16px; }
}

/* Documenti ordine: un colore per tipo */
.ord-fic-bar .gp-btn-doc-ordine {
    background: #2563eb;
    color: #fff;
}
.ord-fic-bar .gp-btn-doc-proforma {
    background: #e67800;
    color: #fff;
}
.ord-fic-bar .gp-btn-doc-fattura {
    background: #16a34a;
    color: #fff;
}
.ord-fic-bar .gp-btn-doc-ddt {
    background: #8e44ad;
    color: #fff;
}
.ord-fic-bar .gp-btn-doc-ordine:hover,
.ord-fic-bar .gp-btn-doc-proforma:hover,
.ord-fic-bar .gp-btn-doc-fattura:hover,
.ord-fic-bar .gp-btn-doc-ddt:hover {
    filter: brightness(1.06);
}

.cli-ship-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}
.cli-ship-row .gp-btn { min-height: 40px; }
#ord-ddt-ov.cfm-ov { z-index: 12000; }
#ord-tnt-ov.cfm-ov { z-index: 12010; }

/* Strip spedizioni sotto Documenti ordine — senza scorrere */
.gp-sped-strip {
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafbfc;
}
.gp-sped-strip[hidden] { display: none !important; }
.gp-sped-strip-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.gp-sped-strip-summary {
    font-size: 13px;
    color: #4a4a6a;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.gp-sped-strip-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
    font-weight: 700;
    font-size: 12px;
}
.gp-sped-strip-elenco {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.gp-sped-strip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: #fff;
    border: 2px solid #cbd5e1;
    font-size: 13px;
    line-height: 1.35;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    min-height: 48px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.gp-sped-strip-row:hover,
.gp-sped-strip-row:focus {
    border-color: #ea580c;
    background: #fff7ed;
    outline: none;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.15);
}
a.gp-sped-strip-row:hover {
    border-color: #ea580c;
    background: #fff7ed;
}
.gp-sped-strip-name {
    flex: 0 0 auto;
    color: #0f172a;
    min-width: 6.5rem;
    font-size: 14px;
}
.gp-sped-strip-qty {
    flex: 1 1 10rem;
    color: #1e293b;
    font-weight: 600;
}
.gp-sped-strip-docs {
    flex: 1 1 12rem;
    color: #334155;
}
.gp-sped-strip-go {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 6px 12px;
    border-radius: 999px;
    background: #ea580c;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    white-space: nowrap;
}
.gp-sped-strip-del {
    flex: 0 0 auto;
    min-height: 36px !important;
    padding: 4px 12px !important;
    border-radius: 999px !important;
    font-size: 12px !important;
}
#btn-nuova-uscita {
    font-weight: 800;
}
.gp-sped-strip-docs a,
.gp-sped-strip-doc {
    color: #7c3aed;
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
}
.gp-sped-strip-head .gp-btn {
    flex: 0 0 auto;
    min-height: 40px;
    border-radius: 999px;
}

.sp-meta-row { margin-top: 8px; }
.sp-docs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
#sp-righe input.sp-qty {
    width: 5.5rem;
    max-width: 5.5rem;
    text-align: right;
    border-radius: 999px;
    appearance: none;
    -webkit-appearance: none;
    font-size: 16px;
    min-height: 40px;
    padding: 0 12px;
}

.ord-ddt-box {
    max-width: 380px;
    width: 100%;
    height: auto;
    max-height: none;
}
.ord-tnt-box {
    width: min(720px, 96vw);
    height: min(640px, 88vh);
    max-width: 96vw;
    max-height: 92vh;
}
.ord-tnt-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    flex: 1 1 auto;
    padding: 12px 14px 14px;
}
.ord-tnt-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: #4a4a6a;
}
.ord-tnt-search {
    flex: 0 0 auto;
    max-width: 100%;
}
.ord-tnt-search input {
    width: 100%;
    max-width: 100%;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 999px;
    font-size: 16px;
}
.ord-tnt-status {
    margin: 0;
    font-size: 11px;
    color: #64748b;
    min-height: 1.2em;
}
.ord-tnt-status.is-err { color: #b91c1c; }
.ord-tnt-hits {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
}
.ord-tnt-hits li { border-bottom: 1px solid #f1f5f9; }
.ord-tnt-hits li:last-child { border-bottom: 0; }
.ord-tnt-hits button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: #fff;
    padding: 10px 12px;
    min-height: 40px;
    font: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.ord-tnt-hits button:hover { background: #fff7ed; }
.ord-tnt-hits strong { display: block; color: #1a1a2e; font-size: 13px; }
.ord-tnt-hits small { display: block; color: #64748b; font-size: 12px; margin-top: 2px; }
.ord-tnt-empty {
    padding: 14px 12px;
    color: #64748b;
    font-size: 13px;
}
.ord-tnt-applied {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    color: #c2410c;
}
.ord-ddt-bd {
    padding: 10px 14px 6px;
    font-size: 13px;
    line-height: 1.4;
    color: #1a1a2e;
    white-space: pre-wrap;
}
.ord-ddt-bd input {
    width: 8.5rem;
    max-width: 100%;
    margin-top: 8px;
}
.ord-ddt-ft {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
    padding: 6px 14px 10px;
    border-top: 0;
}
.ord-ddt-ft .gp-btn {
    border-radius: 999px;
    flex: 0 0 auto;
    min-height: 40px;
    color: #fff;
    padding: 0 12px;
}
.ord-ddt-ft .gp-btn-doc-fattura { background: #16a34a; }
.ord-ddt-ft .gp-btn-doc-proforma { background: #e67800; }
.ord-ddt-ft .gp-btn-ghost { background: #888; color: #fff; }
.ord-ddt-file {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}
.ord-ddt-file input[type="file"] { display: none; }
.ord-ddt-file-name {
    font-size: 13px;
    color: #4a4a6a;
    flex: 1 1 auto;
    min-width: 8rem;
}

/* Forma Telefono: pillola staccata, 4 angoli uguali. Mai uniti a mezzaluna. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]):not([type="image"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="color"]),
select {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 999px !important;
    border: 1px solid #d1d5db;
    background-color: #fff;
    box-sizing: border-box;
}
textarea {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 16px !important;
    border: 1px solid #d1d5db;
    background-color: #fff;
    box-sizing: border-box;
}
input:disabled:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select:disabled,
textarea:disabled {
    background-color: #f4f6f9;
}

select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2364748b' d='M1.2 1.5 6 6.3 10.8 1.5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.7em center;
    background-size: 12px 8px;
    padding-right: 2em;
}

/* Stato job: azzurro / verde / grigio in base al valore */
#job_stato[data-stato="in_gestione"] {
    background-color: #E3F2FD;
}
#job_stato[data-stato="in_produzione"] {
    background-color: #d4edda;
}
#job_stato[data-stato="chiuso"] {
    background-color: #e8eaed;
}

select[multiple],
select[size]:not([size="1"]) {
    background-image: none;
    padding-right: 8px;
    border-radius: 16px !important;
}

.gp-form-grid,
.ord-testata,
.od-campi,
.od-ship-grid,
.od-po-ref,
.od-grid,
.cli-ana-ids,
.cli-ana-pay,
.fic-row-top,
.pay-term-row {
    gap: 12px 14px;
}

.ord-testata .ot-sito input {
    width: 7.6rem;
    flex: 0 0 auto;
}
.gp-field,
.od-campi > label,
.od-ship-grid > label,
.od-po-ref > label,
.od-grid > label {
    min-width: 0;
}

/* Lista prodotti: Q.tà / Unità / Prezzo / Sc.% / IVA ognuno pillola a sé, come Totale */
.fic-row-top {
    gap: 12px 14px !important;
}
.fic-col--codice { width: calc(12ch + 1.6rem); flex-basis: calc(12ch + 1.6rem); }
.fic-col--qty { width: 5.8em; flex-basis: 5.8em; }
.fic-col--unita { width: calc(3ch + 1.8rem); flex-basis: calc(3ch + 1.8rem); }
.fic-col--sconto { width: calc(4ch + 1.8rem); flex-basis: calc(4ch + 1.8rem); }
.fic-line .fic-col input,
.fic-line .fic-col select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
}

/* Tracking, Copia e stato AWB: stessa altezza (override select/button globali) */
.gp-awb-val .gp-awb-chip,
.gp-page--ord .gp-awb-val .gp-awb-chip {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    min-height: 28px;
    padding: 0 10px;
    margin: 0;
    border-width: 1px;
    border-style: solid;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    background-image: none;
    flex: 0 0 auto;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
select.gp-awb-chip {
    background-image: none;
}

/* Valuta / Cambio USD: campi corti, tasto Salva valuta staccato */
.qv-toolbar--top .qv-sel,
.qv-toolbar--top .qv-num {
    width: auto;
    min-width: 4.8em;
    max-width: 7.2rem;
    flex: 0 0 auto;
}
.qv-save-valuta-btn {
    flex: 0 0 auto;
    height: 40px;
    min-height: 40px;
}

@media (max-width: 900px), (max-width: 1100px) and (pointer: coarse) {
    .gp-awb-val .gp-awb-chip,
    .gp-page--ord .gp-awb-val .gp-awb-chip,
    .gp-page--ord .f-ship-status {
        height: 40px;
        min-height: 40px;
        font-size: 16px;
    }
}

/* Carica documento — 4 pad staccati (mai uniti) */
.gp-btn-doc-carica {
    background: #0f766e;
    color: #fff;
}
.gp-btn-doc-carica:hover {
    filter: brightness(1.06);
}
.od-docs-toolbar .gp-btn-doc-carica {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    padding: 8px 14px;
}
.ord-carica-pad .gp-btn-doc-fattura {
    background: #16a34a;
    color: #fff;
}
.ord-carica-pad .gp-btn-doc-proforma {
    background: #e67800;
    color: #fff;
}
.ord-carica-pad .gp-btn-doc-ordine {
    background: #2563eb;
    color: #fff;
}
.ord-carica-pad .gp-btn-doc-foto,
.gp-btn-doc-foto {
    background: #7c3aed;
    color: #fff;
}
.gp-btn-doc-foto:hover {
    filter: brightness(1.06);
}
.ord-carica-banner {
    margin: 0 0 14px;
    padding: 12px 14px 14px;
    border: 1px solid #99f6e4;
    border-radius: 16px;
    background: #f0fdfa;
}
.ord-carica-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.ord-carica-head strong {
    font-size: 15px;
    color: #134e4a;
}
.ord-carica-pads {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}
.ord-carica-pad {
    flex: 1 1 16rem;
    min-width: min(100%, 14rem);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 2px dashed #5eead4;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.ord-carica-pad h3 {
    margin: 0;
    font-size: 14px;
    color: #134e4a;
}
.ord-carica-pad p {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    color: #4b5563;
}
.ord-carica-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: auto;
}
.ord-carica-pick .gp-btn {
    position: relative;
    flex: 0 0 auto;
    min-height: 40px;
    border-radius: 999px;
    width: auto;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.ord-carica-file {
    position: absolute;
    width: 1px !important;
    height: 1px !important;
    max-width: 1px !important;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}
.ord-carica-name {
    font-size: 12px;
    color: #64748b;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 12rem;
}
.ord-carica-pad.is-over {
    border-color: #0f766e;
    background: #ccfbf1;
}
.ord-carica-pad.is-ok {
    border-color: #16a34a;
    background: #dcfce7;
}
.ord-carica-pad.is-err {
    border-color: #dc2626;
    background: #fef2f2;
}
.ord-carica-pad.is-busy {
    opacity: 0.72;
    pointer-events: none;
}
.ord-carica-status {
    margin: 10px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: #134e4a;
}
.ord-carica-status.is-err { color: #b91c1c; }
.ord-carica-cam-ov,
.ord-carica-foto-ov {
    display: none;
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 12020;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(15, 23, 42, 0.55);
}
.ord-carica-cam-ov[hidden],
.ord-carica-foto-ov[hidden] {
    display: none !important;
    pointer-events: none !important;
}
.ord-carica-cam-ov:not([hidden]),
.ord-carica-foto-ov:not([hidden]) {
    display: flex !important;
    pointer-events: auto;
}
.ord-carica-cam-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(640px, 100%);
    max-height: min(92vh, 820px);
    padding: 12px 14px 14px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.35);
}
.ord-carica-cam-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}
.ord-carica-cam-head strong {
    font-size: 15px;
    color: #4c1d95;
}
.ord-carica-cam-head .gp-btn,
.ord-carica-cam-actions .gp-btn {
    flex: 0 0 auto;
    min-height: 40px;
    border-radius: 999px;
    width: auto;
    appearance: none;
    -webkit-appearance: none;
}
.ord-carica-cam-frame {
    position: relative;
    flex: 1 1 auto;
    min-height: 200px;
    max-height: min(62vh, 520px);
    overflow: hidden;
    border-radius: 16px;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ord-carica-cam-frame video {
    display: block;
    width: 100%;
    height: 100%;
    max-height: min(62vh, 520px);
    object-fit: contain;
    background: #000;
}
.ord-carica-cam-guide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.ord-carica-cam-ov.is-locking .ord-carica-cam-frame {
    box-shadow: inset 0 0 0 3px #22c55e;
}
.ord-carica-cam-ov.is-shooting .ord-carica-cam-frame {
    box-shadow: inset 0 0 0 4px #a78bfa;
}
.ord-carica-cam-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    color: #4b5563;
}
.ord-carica-cam-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.ord-carica-foto-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(520px, 100%);
    max-height: min(92vh, 780px);
    padding: 12px 14px 14px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.35);
}
.ord-carica-foto-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}
.ord-carica-foto-head strong {
    font-size: 15px;
    color: #4c1d95;
}
.ord-carica-foto-head .gp-btn {
    flex: 0 0 auto;
    min-height: 40px;
    border-radius: 999px;
    width: auto;
    appearance: none;
    -webkit-appearance: none;
}
.ord-carica-foto-frame {
    flex: 1 1 auto;
    min-height: 180px;
    max-height: min(58vh, 460px);
    overflow: auto;
    border-radius: 16px;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ord-carica-foto-frame img {
    display: block;
    max-width: 100%;
    max-height: min(58vh, 460px);
    width: auto;
    height: auto;
    object-fit: contain;
}
.ord-carica-foto-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.ord-carica-foto-mode {
    flex: 0 0 auto;
    min-height: 40px;
    border-radius: 999px;
    width: auto;
    appearance: none;
    -webkit-appearance: none;
    background: #f3e8ff;
    color: #5b21b6;
}
.ord-carica-foto-mode.is-on {
    background: #7c3aed;
    color: #fff;
}
.ord-carica-foto-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    color: #4b5563;
}
.ord-carica-foto-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.ord-carica-foto-actions .gp-btn {
    flex: 0 0 auto;
    min-height: 40px;
    border-radius: 999px;
    width: auto;
    appearance: none;
    -webkit-appearance: none;
}
.ord-carica-foto-ov.is-busy .ord-carica-foto-actions .gp-btn-doc-foto,
.ord-carica-foto-ov.is-busy .ord-carica-foto-mode {
    opacity: 0.72;
}
@media (max-width: 900px), (max-width: 1100px) and (pointer: coarse) {
    .ord-carica-pads { flex-direction: column; }
    .ord-carica-pad { flex: 1 1 auto; width: 100%; }
    .ord-carica-pick .gp-btn { min-height: 40px; font-size: 16px; }
    .ord-carica-cam-box,
    .ord-carica-foto-box { padding: 10px 12px 12px; }
    .ord-carica-cam-actions .gp-btn,
    .ord-carica-foto-actions .gp-btn,
    .ord-carica-foto-mode { min-height: 40px; font-size: 16px; }
}

/* Nav: Home / breadcrumb / torna indietro — più leggibili ovunque */
.gp-breadcrumb {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 10px;
    line-height: 1.5;
}
.gp-breadcrumb a {
    color: #c2410c;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
}
.gp-breadcrumb a:hover {
    color: #9a3412;
}
.gp-btn-ghost {
    background: #f8fafc !important;
    color: #0f172a !important;
    border: 2px solid #64748b !important;
    font-weight: 700 !important;
    min-height: 40px;
}
.gp-btn-ghost:hover {
    background: #e2e8f0 !important;
    border-color: #334155 !important;
}
.ord-start-crumb {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
}
.ord-start-crumb a {
    color: #c2410c;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
}
.gp-uscita-go {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 999px;
    background: #ea580c;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
}
