:root {
    --background: white;
    --font-color: #4a4a4a;
    --border: lightgray;
    --input-focused-border: darkgray;
    --verde: #16aa2f;
    --verde-bordo: #0e7a1f;
    --verde-hoover: #9af5b1;
    --barcode-background: #51b1ff;
    --barcode-border: #1982fb;
    --bottombar-log: ivory;
    --card-background: ivory;
    --card-action-background: transparent;
    --card-componentes-background: #efefef;
    --card-selected-background: #a5f0b2;
    --accent: #007bff;
    --log-error: red;
    --dataOK: lightgreen;
    --dataKO: lightcoral;

}

.log-error {
    color: var(--log-error);
    font-weight: 500;
}

.log-message {
    color: var(--font-color);
}

.log-time {
    color: var(--font-color);
}

body {
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    text-rendering: optimizeLegibility;
    text-size-adjust: 100%;

    margin: 0;
    color: var(--font-color);
    background-color: var(--background);
    --webkit-font-smoothing: antialiased;
}

h2,
h3,
h3,
h4,
h5,
h6 {
    font-size: .9em;
    font-weight: 300;
    margin: 0;
}

.bold,
b {
    font-weight: 400;
}

.hide {
    display: none !important;
}

.modal {
    display: none;
}

img {
    height: auto;
    width: auto;
    max-height: 100%;
    max-width: 100%;
}

.zoom {
    position: fixed;
    display: none;
    background-color: var(--bottombar-log);
    border: solid 1px var(--verde);
    z-index: 100;

    .selected {
        background-color: var(--card-selected-background);
    }
}

.modal-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    display: none;
    flex-direction: column;
    background-color: var(--bottombar-log);
    border: solid 3px var(--verde);
    z-index: 100;
    padding: 1em;

    .title {
        text-align: center;
        font-size: 1.2em;
        font-weight: bold;
        margin: .5em 0;
        height: 2em;
    }

    .content {
        display: flex;
        flex-direction: column;

        .data {
            display: flex;
            flex-direction: column;

            h3 {
                display: flex;
                flex-direction: row;

                small {
                    width: 2em;
                }
            }
        }

        .data_input {
            display: flex;
            flex-direction: row;
            align-items: baseline;
            margin: .5em 0;

            label {
                width: 6em;
                font-size: .9em;
                margin-right: 1em;
            }

            input {
                width: 10em;
            }
        }

        .act {
            display: flex;
            flex-direction: row;
            justify-content: center;
            margin-top: 1em;

            .button {
                width: 5em;
                margin: 0 .5em;
            }
        }
    }
}


.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* oggetti ricorrenti */

input {
    font-family: inherit;
    padding: .5em;
    border: none;
    border-bottom: solid 1px var(--border);
    width: 10em;
    font-size: 1em;
    background-color: transparent !important;
    padding-bottom: 0;
}

input:focus {
    outline: none;
    border-bottom: solid 1px var(--input-focused-border);
}

/* serve per evitare il cambio colore con l'autoriempimento dei browser */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    -webkit-text-fill-color: var(--font-color) !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

label {
    font-family: inherit;
    margin-bottom: .2em;
    width: 6em;
    font-size: .9em;
}

.description {
    font-size: .8em;
    color: var(--font-color);
    margin-left: 1em;
}


/* button */
.button {
    display: flex;
    font-family: inherit;
    background-color: transparent;
    border: solid 1px var(--verde-hoover);
    border-radius: .3em;
    padding: .5em 1em;
    margin: .2em;
    font-size: 1em;
    justify-content: center;
    align-items: center;
    text-align: center;
    user-select: none;
    /* impedisce la selezione del testo all'interno del bottone */
    transition: 0.3s;
    min-height: 1em;

    &:hover {
        background-color: var(--verde-hoover);
        border-radius: 1em;
        border: 1px solid var(--verde-bordo);
        /* box-shadow: inset 0 0 .5em var(--verde-bordo); */
    }

    &:active {
        background-color: var(--verde);
    }

    &.running {
background-color: lightgreen;
        border-color: #2ecc71;
    }
}

.form_ProduzioneOfficine .act .button.current {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent), 0 0 8px var(--accent);
}

.bolla-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .25);
}

.bolla-modal {
    width: min(42em, calc(100vw - 2em));
    max-height: calc(100vh - 2em);
    overflow: auto;
    background: var(--bottombar-log);
    border: solid 3px var(--verde);
    border-radius: .5em;
    padding: 1em;
}

.bolla-modal-message,
.bolla-modal-section,
.bolla-modal-list {
    display: flex;
    flex-direction: column;
    gap: .35em;
}

.bolla-modal-section {
    margin-top: .75em;
}

.bolla-modal-title {
    font-weight: 700;
}

.bolla-modal-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .5em;
    border-bottom: 1px solid #d8d8d8;
    padding: .3em 0;
}

.bolla-modal-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: .5em;
    margin-top: 1em;
}

.bolla-modal-actions .button {
    width: auto;
    min-width: 7em;
}


.inputField {
    display: flex;
    flex-direction: row;
    margin: .5em 0;
    align-items: baseline;

    .description {
        font-size: .8em;
        color: var(--font-color);
        margin-left: 1em;
    }
}

.title {
    font-size: 1.5em;
    font-weight: bold;
    margin: .5em 0;
}

.card {
    width: 11em;
    border: solid 1px var(--border);
    border-radius: .5em;
    padding: .5em;
    margin: .5em;
    display: flex;
    flex-direction: row;
    background-color: var(--card-background);
    cursor: default;

    .card_data {
        flex: 1;
    }

    .card_act {
        background-color: var(--card-action-background);
    }

    &.selected {
        background-color: var(--card-selected-background);
    }

    .component {
        background-color: var(--card-componentes-background);
    }

    h3,
    h4 {
        display: flex;
        flex-direction: row;

        small {
            width: 2em;
        }
    }

    h4 {
        font-size: .8em;
    }
}

.improduttive-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .4em;
    align-items: stretch;
}

.improduttive-active-list {
    display: flex;
    flex-direction: column;
    gap: .25em;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: .5em;
}

.improduttiva-button {
    min-width: 12em;
    cursor: default;

    &.active,
    &.alarm {
        background-color: lightcoral;
        border-color: lightcoral;
    }
}

.button.alarm {
    background-color: lightcoral;
    border-color: lightcoral;
}

.utensili-list {
    display: flex;
    flex-direction: column;
    gap: .5em;
    width: 100%;
}

.utensile-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75em;
    align-items: center;
    border: solid 1px var(--border);
    border-radius: .4em;
    padding: .55em;
    background-color: var(--card-background);
}

.utensile-main {
    min-width: 0;
}

.utensile-codice {
    font-weight: 500;
    overflow-wrap: anywhere;
}

.utensile-descrizione {
    font-size: .9em;
    overflow-wrap: anywhere;
}

.utensile-last,
.utensile-pezzi {
    margin-top: .25em;
    font-size: .85em;
}

.utensile-actions {
    display: flex;
    flex-direction: row;
    gap: .35em;
}

.utensile-action {
    min-width: 7em;
    cursor: default;
}

.note-editor {
    display: flex;
    flex-direction: column;
    gap: .75em;
    width: 100%;
    box-sizing: border-box;
}

.note-textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

.note-actions {
    display: flex;
    align-items: center;
    gap: .75em;
}

.note-message {
    font-size: .8em;
    opacity: .8;
}

.counters-edit-list {
    display: flex;
    flex-direction: column;
    gap: .5em;
    width: 100%;
    box-sizing: border-box;
}

.counter-edit-row {
    display: grid;
    grid-template-columns: minmax(10em, 1fr) 8em 8em 7em;
    gap: .6em;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    border: solid 1px var(--border);
    border-radius: .4em;
    padding: .55em;
    background-color: var(--card-background);
}

.counter-edit-row.not-configured {
    opacity: .75;
}

.counter-edit-name,
.counter-edit-meta,
.counter-pending {
    overflow-wrap: anywhere;
}

.counter-edit-meta,
.counter-pending,
.counter-edit-current span,
.counter-message {
    font-size: .8em;
    opacity: .8;
}

.counter-edit-current {
    display: flex;
    flex-direction: column;
    gap: .15em;
}

.counter-edit-input {
    width: 100%;
    box-sizing: border-box;
}

.counter-save {
    min-width: 0;
}

.counter-save.disabled {
    opacity: .45;
    cursor: default;
}

@media (max-width: 760px) {
    .counter-edit-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

.qualita-ciclo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .75em;
    margin: .35em 0 .5em;
    max-width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
}

.qualita-qta-label {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    white-space: nowrap;
    width: auto;
    min-width: max-content;
    margin: 0;
}

.qualita-sample-qty {
    width: 4em;
    min-width: 4em;
    text-align: center;
    flex: 0 0 4em;
    padding-left: .25em;
    padding-right: .25em;
}

.qualita-table-wrap {
    width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}

.qualita-table {
    width: 100%;
    min-width: 36em;
    border-collapse: collapse;
}

.qualita-table th,
.qualita-table td {
    border-bottom: solid 1px var(--border);
    padding: .35em;
    vertical-align: middle;
}

.qualita-table th {
    text-align: left;
}

.qualita-table th:first-child,
.qualita-fase {
    width: 4.5em;
    text-align: center;
    font-weight: bold;
}

.qualita-table th:not(:first-child):not(:nth-child(2)):not(:nth-child(3)),
.qualita-measure-cell {
    width: 4.5em;
    text-align: center;
}

.qualita-row {
    background-color: var(--card-background);
}

.qualita-row.ok {
    background-color: lightgreen;
}

.qualita-row.deroga {
    background-color: #fff3a3;
}

.qualita-row.ko {
    background-color: lightcoral;
}

.qualita-main {
    min-width: 12em;
}

.qualita-title,
.qualita-meta,
.qualita-limits {
    overflow-wrap: anywhere;
}

.qualita-meta,
.qualita-limits {
    font-size: .85em;
}

.qualita-limits {
    min-width: 8em;
}

.qualita-limits span {
    display: block;
}

.qualita-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.qualita-input.ok {
    background-color: lightgreen;
}

.qualita-input.deroga {
    background-color: #fff3a3;
}

.qualita-input.ko {
    background-color: lightcoral;
}

.qualita-actions {
    display: flex;
    gap: .5em;
    margin-top: .75em;
}

.qualita-save,
.qualita-cancel {
    width: 10em;
}

.qualita-save.disabled {
    opacity: .45;
    cursor: default;
}

.qualita-save.saved {
    background-color: lightgreen;
}

.log-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow: auto;
    box-sizing: border-box;
}

.log-table {
    width: 100%;
}

.log-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .35em;
    margin: .35em 0 .6em;
}

.log-filter-button {
    border: 1px solid var(--verde-bordo);
    background-color: ivory;
    color: var(--verde-bordo);
    cursor: pointer;
    padding: .25em .7em;
}

.log-filter-button.active {
    background-color: var(--verde);
    color: white;
}

.log-table th,
.log-table td {
    text-align: left;
    vertical-align: top;
}

.pezzi-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
    gap: .35em;
    align-items: end;
    width: 100%;
}

.pezzi-field {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: .25em;
    align-items: baseline;
    min-width: 0;
}

.pezzi-field label {
    white-space: nowrap;
}

.pezzi-field input {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.ordine-fasi-list {
    display: flex;
    flex-direction: column;
    gap: .15em;
    font-size: 80%;
    margin-top: .2em;
}

.alarms {
    margin-top: .4em;
}

.alarm-row {
    display: block;
    margin: .15em 0;
    padding: .15em .35em;
    background-color: rgba(255, 255, 255, .45);
    border-left: .25em solid lightcoral;
    font-size: .9em;
}

/* .running {
    background-color: lightgreen;
}

.alarm {
    background-color: lightcoral;
}

.info {
    background-color: lightblue;
} */

.machine-card {
    width: 20em;
    border: solid 1px var(--border);
    border-radius: .5em;
    padding: .5em;
    margin: .5em;
    display: flex;
    flex-direction: column;
    background-color: var(--card-background);
    cursor: default;

    .card_data {
        flex: 1;
    }

    &.running {
        background-color: lightgreen;
    }

    &.alarm {
        background-color: lightcoral;
    }

    &.info {
        background-color: lightblue;
    }

    &.current {
        border: solid 3px var(--accent);
        box-shadow: 0 0 8px var(--accent);
    }

    .bolla-info {
        margin-top: 0.5em;
        padding: 0.5em;
        background-color: rgba(255, 255, 255, 0.7);
        border-radius: 0.3em;
        font-size: 0.85em;

        .bolla-row {
            margin: 0.2em 0;

            &.oe {
                font-weight: bold;
                color: #333;
            }

            &.cliente {
                color: #555;
            }

            &.articolo {
                color: #666;
            }
        }
    }

    .card_act {
        background-color: var(--card-action-background);
    }

    &.selected {
        background-color: var(--card-selected-background);
    }

    .component {
        background-color: var(--card-componentes-background);
    }

    h3,
    h4 {
        display: flex;
        flex-direction: row;

        small {
            width: 2em;
        }
    }

    h4 {
        font-size: .8em;
    }
}

.form_macchine {
    .data {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        align-content: flex-start;
    }

    .machines-container {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        align-content: flex-start;
    }

    .machine-card {
        width: 17em;
        height: 19em;
        flex: 0 0 17em;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        overflow: hidden;
    }

    .machine-card .card_data {
        height: 100%;
        flex: 1;
        min-width: 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: .18em;
    }

    .machine-card .card-row {
        line-height: 1.2;
    }

    .machine-card .card-body {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: .18em;
        overflow: hidden;
    }

    .machine-card .machine-name {
        font-size: 150%;
        text-align: center;
    }

    .machine-card .machine-status {
        font-size: .9em;
        font-weight: bold;
    }

    .machine-card .last-seen {
        margin-top: auto;
        padding-top: .25em;
        font-size: 80%;
        opacity: .8;
    }

    .machine-card .bolla-info,
    .machine-card .alarms,
    .machine-card .info-events {
        margin-top: 0;
    }

    .machine-card .bolla-info {
        padding: .35em;
    }

    .machine-counters,
    .machine-counter {
        min-width: 0;
    }

    .machine-card .counter-item,
    .machine-card .machine-counter {
        display: flex;
        gap: .25em;
    }

    .machine-card .articolo-desc,
    .machine-card .alarm-row {
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

/* pannelli  */

.navbar {
    background-color: var(--verde);
    width: 95%;
    margin: 0 auto;
    height: 3em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;

    img {
        height: 80%;
        margin-left: 1em;
    }

    .azi {
        color: white;
        font-size: 1.2em;
        margin-left: 1em;
        font-weight: bold;
    }

    .loginBtn {
        background-color: #a5f0b2;
        border-radius: 1em;
        border: .2em solid var(--verde);
        padding: .2em 1em;
        margin-right: 1em;
        color: var(--verde);
        font-weight: bold;
        cursor: pointer;
    }
}

.user-menu {
    position: absolute;
    top: 2.8em;
    right: 3.5%;
    z-index: 5000;
    min-width: 12em;
    background: ivory;
    border: 1px solid var(--verde-bordo);
    box-shadow: 0 .2em .6em #0002;
}

.user-menu-item {
    padding: .65em .9em;
    border-bottom: 1px solid #d8d8d8;
    cursor: pointer;
    color: #444;
}

.user-menu-item:last-child {
    border-bottom: 0;
}

.user-menu-item:hover {
    background: #e8ffe8;
}

.centerPanel {
    flex: 1;
    width: 95%;
    height: 100%;
    min-height: 0;
    margin: 0 auto;
    font-size: 1em;
    display: flex;
    justify-content: center;
    align-items: center;
}

.bottomBar {
    height: 3em;
    width: 95%;
    display: flex;
    margin: 0 auto;
    flex-direction: row;

    #pnlLog {
        border: 1px solid var(--verde);
        overflow: hidden;
        font-size: .8em;
        background-color: var(--bottombar-log);
        white-space: nowrap;
        overflow-y: scroll;
        text-overflow: ellipsis;
        line-height: 1.3em;
        flex: 1;
    }

    #btnBarCode {
        display: flex;
        background-color: var(--barcode-background);
        border-radius: 1em;
        border: .2em solid var(--barcode-border);
        padding: .2em 1em;
        margin: .3em;
        color: white;
        font-weight: bold;
        width: 8em;
        justify-content: center;
        align-items: center;
        user-select: none;
        /* impedisce la selezione del testo all'interno del bottone */
    }

    &.large_log {
        height: 20em;
    }

}

.printer {
    flex-direction: column;

    select {
        width: 90%;
    }
}

.column2 {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        'col1 col2';
    height: 100%;

    .col1,
    .col2 {
        padding: .5em;

        img {
            max-width: 20em;
            max-height: 20em;
            margin-right: 2em;
        }
    }
}


/* form */
/* FORM STANDARD */

.form_std {
    display: grid;
    grid-template-columns: auto 15em;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        'head act'
        'data act';
    height: 100%;

    .head {
        grid-area: head;

        .info {
            border: solid 1px lightgray;
            padding: .5em 1em;
        }

        .row {
            display: flex;
            flex-direction: row;
            padding: .3em 0;
            background-color: ivory;
            border: solid 1px lightgray;
        }

        .to_dx {
            margin-left: auto;
        }

        .bar {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
            margin-top: .5em;
        }

        b {
            border-bottom: solid 1px lightgray;
        }

        h2,
        h3 {
            height: 1.7em;
        }
    }

    .data {
        grid-area: data;
        padding-top: .5em;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        overflow-y: auto;
        min-height: 0;
        align-items: flex-start;
        align-content: flex-start;
    }

    .act {
        grid-area: act;
        display: flex;
        flex-direction: column;
        padding-left: .5em;
        align-items: center;

        .button {
            width: calc(100% - 4em);
        }

        .etichette8 {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            width: calc(100% - 2em);
            margin: 1em 0;
            border: solid 1px var(--verde-hoover);
            align-items: center;
            justify-content: center;

            .button {
                width: 3em;
                margin: 0;
            }
        }
    }

    b {
        padding: 0 1em;
    }

    .box {
        border: solid 1px var(--border);
        margin-right: 5em;
        margin-top: 1em;
        padding: 1em;
    }

    table {
        width: 100%;
        border-spacing: 0 1px;

        tr {
            height: 2em;
        }
    }

    .dataOK {
        background-color: var(--dataOK);
    }

    .dataKO {
        background-color: var(--dataKO);
    }

    .search {
        grid-area: search;
        border: solid 1px var(--verde-bordo);
        background-color: var(--card-background);
        padding: 0 1em;
        display: flex;
        flex-direction: column;

        .label {
            margin-top: .5em;
        }

        .bar {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
        }
    }

}

.form_ProduzioneOfficine {
    --produzione-head-height: 20em;
    --produzione-disegno-height: var(--produzione-head-height);
    display: grid;
    grid-template-columns: 15em minmax(24em, 1fr) 30% 15em;
    grid-template-rows: 2em auto 1fr;
    grid-template-areas:
        'isola      ordine  disegno act'
        'macchine   ordine  disegno act'
        'macchine   data    data    act';
    height: 100%;

    .isola {
        grid-area: isola;
        border: solid 1px lightgray;
        padding: 0 1em;
        display: flex;
        flex-direction: row;
        align-items: baseline;

        label {
            width: 3em;
        }

        .inputField {
            display: flex;
            flex-direction: row;
            align-items: baseline;
            width: 100%;
            margin: 0;
        }

        .inputField input {
            width: 8em;
            border: none;
            border-bottom: solid 1px var(--border);
            background-color: transparent;
        }

        .inputField .description {
            display: none;
        }

        select {
            width: 8em;
            border: none;
            border-bottom: solid 1px var(--border);
            background-color: transparent;
        }
    }

    .macchine {
        grid-area: macchine;
        border: solid 1px lightgray;
        padding: .5em 0;
        overflow-y: auto;

        .machine-card {
            box-sizing: border-box;
            margin: .5em auto;
            width: calc(100% - 1em);
            height: auto;
            min-height: 0;
            padding: .5em;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        .machine-card .card_data {
            height: 100%;
            min-height: 0;
            display: flex;
            flex-direction: column;
            gap: .18em;
        }

        .machine-card .card-row {
            line-height: 1.2;
        }

        .machine-card .card-body {
            flex: 1;
            min-height: 0;
            display: flex;
            flex-direction: column;
            gap: .18em;
            overflow: hidden;
        }

        .machine-card .machine-name {
            font-size: 115%;
            text-align: center;
            overflow-wrap: anywhere;
        }

        .machine-card .machine-status {
            font-size: .9em;
            font-weight: bold;
        }

        .machine-card .bolla-info,
        .machine-card .alarms {
            margin-top: 0;
        }

        .machine-card .bolla-info {
            padding: .35em;
        }

        .machine-card .articolo-desc,
        .machine-card .articolo-cod,
        .machine-card .oe-row,
        .machine-card .counter-item,
        .machine-card .alarm-row {
            max-width: 100%;
            overflow-wrap: anywhere;
            overflow: hidden;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }

        .machine-card .last-seen {
            padding-top: .25em;
            font-size: 80%;
            opacity: .8;
        }
    }

    .ordine {
        grid-area: ordine;
        min-height: var(--produzione-head-height);
        padding: .5em;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
        overflow-wrap: anywhere;
    }

    .ordine-container,
    .ordine-info {
        width: 100%;
        min-height: var(--produzione-head-height);
        box-sizing: border-box;
    }

    .ordine-info {
        display: flex;
        flex-direction: column;
        gap: .4em;
        overflow: auto;
    }

    .ordine-card-row-group {
        display: flex;
        flex-direction: row;
        gap: .4em;
        align-items: stretch;
        width: 100%;
        min-width: 0;
        flex: 1 1 0;
    }

    .ordine-card {
        border: 1px solid #ddd;
        background-color: #fffff2;
        border-radius: .25em;
        padding: .35em .45em;
        min-width: 0;
        flex: 1 1 0;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .ordine-card-cliente,
    .ordine-card-articolo,
    .ordine-card-qta,
    .ordine-card-parent-usn {
        flex-basis: 100%;
    }

    .ordine-card-label {
        font-size: 80%;
        opacity: .75;
        margin-bottom: .2em;
    }

    .ordine-card-main {
        font-weight: bold;
        overflow-wrap: anywhere;
    }

    .ordine-card-inline {
        display: flex;
        align-items: baseline;
        gap: .5em;
        min-width: 0;
    }

    .ordine-card-macchina .ordine-card-main {
        font-size: 130%;
        text-align: center;
    }

    .ordine-card-parent-usn .ordine-card-main {
        font-size: 130%;
        text-align: center;
    }

    .ordine-card-parent-usn {
        cursor: pointer;
    }

    .ordine-card-articolo-head {
        align-items: baseline;
    }

    .ordine-card-articolo-head .ordine-card-sub {
        margin-left: auto;
        text-align: right;
    }

    .ordine-qta-da-produrre b {
        font-size: 120%;
    }

    .ordine-qta-prodotta b {
        font-size: 150%;
        font-weight: bold;
    }

    .ordine-card-qta .ordine-card-row {
        align-items: baseline;
    }

    .ordine-card-parent-usn .ordine-card-row {
        justify-content: flex-start;
    }

    .ordine-card-sub {
        font-size: 90%;
        overflow-wrap: anywhere;
    }

    .ordine-card-row {
        display: flex;
        justify-content: space-between;
        gap: .5em;
    }

    .disegno {
        grid-area: disegno;
        display: flex;
        flex-direction: column;
        align-self: start;
        align-items: center;
        min-width: 0;
        min-height: var(--produzione-head-height);
        height: var(--produzione-disegno-height);
        max-height: var(--produzione-disegno-height);
        padding: .5em;
        box-sizing: border-box;
        overflow: hidden;

        .disegno-container {
            border: 1px solid #ddd;
            background-color: #fff;
            border-radius: .25em;
            width: 100%;
            height: 100%;
            box-sizing: border-box;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        img {
            width: calc(100% - 1em);
            height: calc(100% - 1em);
            object-fit: contain;
            margin: 0;
        }

        img[hidden],
        img:not([src]) {
            display: none;
        }
    }

    .data {
        grid-area: data;
        padding-top: .5em;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        min-width: 0;
        align-items: flex-start;
        align-content: flex-start;
    }

    .act {
        grid-area: act;
        display: flex;
        flex-direction: column;
        padding-left: .5em;
        align-items: center;

        .button {
            width: calc(100% - 4em);
        }
    }

    b {
        padding: 0;
    }

    .box {
        border: solid 1px var(--border);
        margin-right: 5em;
        margin-top: 1em;
        padding: 1em;
    }

    table {
        width: 100%;
        border-spacing: 0 1px;

        tr {
            height: 2em;
        }
    }

    .search {
        grid-area: search;
        border: solid 1px var(--verde-bordo);
        background-color: var(--card-background);
        padding: 0 1em;
        display: flex;
        flex-direction: column;

        .label {
            margin-top: .5em;
        }

        .bar {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
        }
    }

}


.form_ProduzioneOfficine .data-panel {
    display: none;
}

.form_ProduzioneOfficine .data-panel.is-active {
    display: block;
}

.form_ProduzioneOfficine .startstop-panel {
    width: 100%;
    box-sizing: border-box;
}

.form_ProduzioneOfficine .componenti-data-container {
    width: 100%;
    box-sizing: border-box;
}

.componenti-data {
    width: 100%;
    box-sizing: border-box;
    margin-top: .75em;
}

.componenti-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow: auto;
    box-sizing: border-box;
}

.componenti-table {
    width: 100%;
    border-collapse: collapse;
}

.componenti-table th,
.componenti-table td {
    padding: .25em .35em;
    border-bottom: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}

.componenti-table .dataOK {
    background-color: var(--dataOK);
}

.componenti-table .dataKO {
    background-color: var(--dataKO);
}

.componente-codice,
.componente-descrizione,
.componente-lotto,
.componente-usn,
.componente-sn {
    overflow-wrap: anywhere;
}

.form_ProduzioneOfficine .utensili-panel {
    box-sizing: border-box;
    width: 100%;
}

.form_ProduzioneOfficine .note-panel {
    box-sizing: border-box;
    width: 100%;
}

.form_ProduzioneOfficine .contatori-panel {
    box-sizing: border-box;
    width: 100%;
}

.form_ProduzioneOfficine .qualita-panel {
    box-sizing: border-box;
    width: 100%;
}

.form_ProduzioneOfficine .log-panel {
    box-sizing: border-box;
    width: 100%;
}


#mainForm {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;

}

/* MENU */
#panel0 {
    width: 95%;
    margin: 0 auto;

    .panel0 {
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    .button {
        /* width: 10em; */
        height: 1em;
    }

    .title {
        flex-grow: 1;
        width: auto;
        text-align: center;
    }
}

#panel1 {
    flex: 1;
    width: 100%;
    height: 100%;

    .main_menu {
        margin: 1em 0;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    .button {
        min-width: 20em;
        /* width: calc(50% - 2.6em); */
        flex: 1 1 calc(45%);
    }

}

#panel2 {
    width: 100%;
    height: 100%;
}

/* pannello login */
#loginModal {
    align-items: center;
    justify-content: center;
    border-radius: 1em;

    padding: 2em;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--verde);
    background-color: ivory;

    .inputField {
        margin: .5em 0;
        width: 20em;
    }

    .button {
        display: flex;
        width: 50%;
        height: 2em;
        background-color: var(--verde);
        border-radius: 1em;
        border: .2em solid var(--verde-bordo);
        padding: .2em 1em;
        margin: .3em;
        color: white;
        font-weight: bold;
        justify-content: center;
        align-items: center;
        user-select: none;
        /* impedisce la selezione del testo all'interno del bottone */
    }

}

.auth-modal {
    align-items: center;
    justify-content: center;
    border-radius: 1em;
    padding: 2em;
    flex-direction: column;
    border: 1px solid var(--verde);
    background-color: ivory;

    .content {
        min-width: min(28em, 90vw);
    }

    .actions {
        display: flex;
        gap: .5em;
        justify-content: center;
        margin-top: 1em;
        flex-wrap: wrap;
    }
}

.auth-links {
    display: flex;
    justify-content: center;
    gap: 1em;
    margin-top: .75em;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--verde-bordo);
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

.auth-message {
    min-height: 1.2em;
    color: var(--log-error);
    text-align: center;
    margin: .5em 0;
}

.auth-message.ok {
    color: var(--verde-bordo);
}

.printers-list {
    display: flex;
    flex-direction: column;
    gap: .35em;
    margin: .75em 0;
}

.printer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.3em 2.3em 2.3em;
    align-items: center;
    gap: .4em;
    border-bottom: 1px solid #d8d8d8;
    padding: .35em 0;
}

.printer-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-button {
    height: 2em;
    border: 1px solid var(--verde-bordo);
    background: ivory;
    color: var(--verde-bordo);
    cursor: pointer;
}

.printer-add-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5em;
    align-items: end;
}


#rulesHead {
    display: grid;
    grid-template-columns: 50% 50%;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        'rulesKey rulesKey'
        'snData docData'
        'search search';
    height: 100%;

    .rulesKey {
        grid-area: rulesKey;

        label {
            width: 8em;
        }

        input {
            width: 20em;
        }
    }

    .snData {
        grid-area: snData;
        border: solid 1px lightgray;
        margin: 1em .5em 1em 0;
        padding: 0 1em;
    }

    .docData {
        grid-area: docData;
        border: solid 1px lightgray;
        margin: 1em 0 1em .5em;
        padding: 0 1em;

        .row {
            display: flex;
            flex-direction: row;
            align-items: baseline;
            background-color: transparent;
            border: none;
        }

        input {
            width: 70%;
        }

        select {
            width: 30%;
            border: none;
            background-color: transparent;
        }
    }

}

#waitModal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 70%;
    cursor: wait;
    display: none;
    flex-direction: column;
    background-color: var(--bottombar-log);
    border: solid 3px var(--verde);
    z-index: 100;
    padding: 1em;
    font-size: 4em;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        display: none;
    }

    70% {
        opacity: 0.1;
        display: none;
    }

    100% {
        opacity: 1;
        display: block;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   form Configurazione terminale TF42
   ═══════════════════════════════════════════════════════════════════════════ */
.di-grid {
    display: flex;
    flex-direction: column;

    .di-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        margin: 0;

        label {
            display: none;
        }

        .di-cell-num {
            width: 2em;
        }

        .di-cell-mac {
            width: 20em;
        }

        .di-cell-parametro {
            width: 20em;
        }

        .di-cell-nome {
            width: 16em;
        }

        .di-cell-tipo {
            width: 10em;
        }
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
OCR VISION SCANNER STYLES
═══════════════════════════════════════════════════════════════════════════ */

.ocr-container {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ocr-overlay {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {

    0%,
    100% {
        border-color: #00ff00;
    }

    50% {
        border-color: #ffff00;
    }
}

#btnBarCode.is-danger {
    background: #ff4444 !important;
    color: white !important;
}

.ocr-status {
    font-family: monospace;
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
    FORM STATUS (Stato Reparto) — Tabella operatori
    ═══════════════════════════════════════════════════════════════════════════ */

.form_status {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;

    .head {
        border: solid 1px var(--verde-bordo);
        background-color: var(--card-background);
        padding: 0 1em;
        display: flex;
        flex-direction: column;

        .label {
            margin-top: .5em;
        }
    }

    .data {
        display: flex;
        overflow-y: auto;
        min-height: 0;

    }

    .reparto-container {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .act {
        display: flex;
        flex-direction: row;
        justify-content: center;
        margin-top: .5em;
    }
}

.stato-reparto-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;

    thead {
        background-color: var(--verde);
        color: white;
        position: sticky;
        top: 0;
        z-index: 10;

        th {
            padding: 0.6em 0.4em;
            text-align: left;
            font-weight: 500;
            white-space: nowrap;
            border-right: 1px solid rgba(255, 255, 255, 0.2);

            &:last-child {
                border-right: none;
            }
        }
    }

    tbody {
        tr {
            border-bottom: 1px solid var(--border);
            transition: background-color 0.2s;

            &:hover {
                background-color: var(--verde-hoover);
            }
        }

        td {
            padding: 0.5em 0.4em;
            vertical-align: middle;
        }
    }

    .col-risorsa {
        font-weight: 500;
        width: 10%;
        text-align: center;
        vertical-align: middle;
        font-size: 1.8em;
    }

    .col-oe {
        width: 12%;
        text-align: center;
        vertical-align: middle;
    }

    .col-oe .oe-r1 {
        font-size: 1.5em;
        color: #333;
    }

    .col-oe .oe-r2 {
        font-size: 2.2em;
        font-weight: 500;
    }

    .col-attivita {
        width: 8%;
        text-align: center;
        vertical-align: middle;
        font-size: 1.8em;
    }

    .col-articolo {
        width: 22%;
    }

    .col-articolo .art-cod {
        font-size: 2.2em;
        font-weight: 500;
    }

    .col-articolo .art-descr {
        font-size: 1.5em;
        color: #666;
    }

    .col-qta {
        width: 8%;
        text-align: center;
        vertical-align: middle;
        font-size: 1.8em;
    }

    .col-qta-prod b {
        font-weight: 700;
    }

    .col-perc {
        width: 10%;
        vertical-align: middle;
    }

    .col-data-inizio {
        width: 12%;
        white-space: nowrap;
        font-size: 1.8em;
        text-align: center;
        vertical-align: middle;
    }

    .data-inizio-allarme {
        background-color: #ffe0b2;
    }

    .col-stato {
        width: 10%;
        text-align: center;
        vertical-align: middle;
        font-size: 1.8em;
    }
}

.perc-bar-container {
    width: 100%;
    height: 1.4em;
    background-color: #e0e0e0;
    border-radius: 0.3em;
    position: relative;
    overflow: hidden;

    .perc-bar {
        height: 100%;
        background: linear-gradient(90deg, var(--verde), #2ecc71);
        border-radius: 0.3em;
        transition: width 0.3s ease;
    }

    .perc-text {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 1.6em;
        font-weight: 500;
        color: #333;
        white-space: nowrap;
    }
}

.badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    border-radius: 0.5em;
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
}

.badge-in-corso {
    background-color: #28a745;
    color: #fff;
    border: 1px solid #1e7e34;
}

.badge-inattivo {
    background-color: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

.stato-in-corso {
    background-color: #f8fff8;
}

.stato-inattivo {
    background-color: #f5f5f5;
    color: #999;
}

.no-data-reparto {
    padding: 2em;
    text-align: center;
    color: #999;
    font-size: 1.1em;
}

.machine-order-actions {
    white-space: nowrap;
}

.machine-order-actions button {
    min-width: 2em;
    margin-right: .25em;
}

.role-menu-items {
    width: 100%;
    box-sizing: border-box;
    max-width: 52em;
    margin-top: .5em;
}

.role-menu-title {
    font-weight: bold;
    margin-bottom: .45em;
    color: #444;
}

.role-menu-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
}

.role-menu-row {
    display: flex;
    min-width: 20em;
    flex: 1 1 calc(45%);
    min-height: 2.2em;
    cursor: pointer;
    box-sizing: border-box;
}

.role-menu-row:has(.role-menu-check:checked) {
    border-color: var(--verde-bordo);
    background-color: var(--verde-hoover);
    font-weight: bold;
}

.role-menu-check {
    display: none;
}

.role-menu-label {
    width: 100%;
    text-align: center;
    overflow-wrap: anywhere;
}

.form_batch .batch-fields {
    display: grid;
    grid-template-columns: minmax(9em, 14em) minmax(16em, 1fr) auto;
    gap: .6em 1em;
    align-items: end;
    width: 100%;
    box-sizing: border-box;
}

.form_batch .batch-wide,
.form_batch .batch-payload,
.form_batch .batch-preview {
    grid-column: 1 / -1;
}

.form_batch textarea {
    width: 100%;
    min-height: 8em;
    box-sizing: border-box;
    border: 0;
    border-bottom: 1px solid #ccc;
    background-color: transparent;
    font: inherit;
}

.batch-check {
    display: flex;
    align-items: center;
    gap: .35em;
    min-height: 2em;
    color: #444;
}

.batch-preview {
    color: #666;
    font-size: .9em;
    min-height: 1.5em;
}

.reparto-tree-table {
    min-width: 42em;
}

.reparto-tree-table th,
.reparto-tree-table td {
    padding: .25em .5em;
    vertical-align: middle;
}

.reparto-tree-row {
    cursor: pointer;
}

.reparto-tree-row:hover {
    background-color: var(--verde-hoover);
}

.reparto-tree-name {
    width: 18em;
}

.reparto-tree-cell {
    display: flex;
    align-items: center;
    min-height: 1.8em;
    padding-left: calc(var(--tree-level, 0) * 1.5em);
    gap: .35em;
}

.reparto-tree-root,
.reparto-tree-branch {
    display: inline-block;
    width: 1em;
    flex: 0 0 1em;
}

.reparto-tree-root::before {
    content: "";
    display: block;
    width: .45em;
    height: .45em;
    border-radius: 50%;
    background: var(--verde);
    margin-left: .25em;
}

.reparto-tree-branch::before {
    content: "└";
    color: var(--verde-bordo);
    font-weight: 600;
}

.reparto-tree-code {
    font-weight: 600;
}

.reparto-tree-count {
    border: solid 1px var(--verde-bordo);
    border-radius: 999px;
    color: var(--verde-bordo);
    font-size: .8em;
    min-width: 1.5em;
    padding: 0 .35em;
    text-align: center;
}

.reparto-tree-machines {
    width: 6em;
    text-align: right;
}

.reparto-edit-title {
    font-weight: 700;
    margin: .75em 0 .35em;
    padding-top: .65em;
    border-top: solid 1px var(--border);
}

.reparto-edit-title:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
