/* ==================================================
   CNC Setup Manager
   Version 1.2
================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    color: #2c3e50;
    background-color: #eef2f7;
}

/* ==================================================
   Kopfbereich
================================================== */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;

    padding: 25px 40px;

    color: white;
    background-color: #1f4e79;
}

.header-title h1 {
    margin-bottom: 5px;
    font-size: 40px;
}

.header-title p {
    font-size: 18px;
}

.header-information {
    display: flex;
    align-items: center;
    gap: 12px;
}

.version {
    padding: 11px 18px;

    font-weight: bold;

    color: #1f4e79;
    background-color: white;

    border-radius: 8px;
}

.header-button {
    padding: 11px 18px;

    font-weight: bold;

    color: #1f4e79;
    background-color: white;

    border: none;
    border-radius: 8px;

    cursor: pointer;
}

.header-button:hover {
    background-color: #dbe8f5;
}

/* ==================================================
   Seitenbereich
================================================== */

.page-container {
    width: 95%;
    max-width: 1600px;

    margin: 30px auto;
}

/* ==================================================
   Karten
================================================== */

.card {
    margin-bottom: 25px;
    padding: 30px;

    background-color: white;

    border-radius: 12px;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

/* ==================================================
   Abschnittsüberschriften
================================================== */

.section-heading {
    display: flex;
    align-items: center;
    gap: 12px;

    margin-bottom: 25px;
}

.section-heading h2 {
    margin: 0;

    font-size: 26px;
    color: #1f4e79;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    flex-shrink: 0;

    font-weight: bold;
    color: white;
    background-color: #1f4e79;

    border-radius: 8px;
}

/* ==================================================
   Allgemeine Formulare
================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}
.order-data-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-field {
    display: flex;
    flex-direction: column;

    min-width: 0;
}

.form-field label {
    margin-bottom: 8px;

    font-weight: 600;
    color: #1f4e79;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;

    padding: 11px;

    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 15px;

    color: #2c3e50;
    background-color: white;

    border: 1px solid #cfd8dc;
    border-radius: 6px;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: #1f4e79;

    box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}

.form-field textarea {
    min-height: 110px;
    resize: vertical;
}

/* ==================================================
   Stangenlader
================================================== */

.stangenlader-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 30px;
}

.inline-form-field {
    display: grid;
    grid-template-columns: minmax(180px, 1.5fr) minmax(110px, 1fr);
    align-items: center;
    gap: 12px;
}

.inline-form-field label {
    margin-bottom: 0;
}

.subsection {
    margin-top: 30px;
    padding-top: 25px;

    border-top: 2px solid #dbe3ea;
}

.subsection h3 {
    margin-bottom: 20px;

    font-size: 21px;
    color: #1f4e79;
}

.torque-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 30px;
}

.remarks-field {
    margin-top: 20px;
}

/* ==================================================
   Responsive Darstellung
================================================== */

/* Kleinere PC-Bildschirme und Tablets quer */

@media (max-width: 1250px) {
    .form-grid,
    .stangenlader-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .torque-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablets hochkant */

@media (max-width: 800px) {
    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-information {
        flex-wrap: wrap;
    }

    .form-grid,
    .stangenlader-grid,
    .torque-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 22px;
    }
}

/* Smartphones */

@media (max-width: 500px) {
    .app-header {
        padding: 20px;
    }

    .header-title h1 {
        font-size: 29px;
    }

    .page-container {
        width: calc(100% - 20px);
        margin-top: 15px;
    }

    .section-heading h2 {
        font-size: 22px;
    }
}

/* ==================================================
   Druckansicht
================================================== */

@media print {
    body {
        background-color: white;
    }

    .app-header {
        padding: 15px 20px;
    }

    .header-button {
        display: none;
    }

    .page-container {
        width: 100%;
        max-width: none;
        margin: 15px 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #b0b0b0;
    }
}/* ==================================================
   Version 1.5 – Spannmittel
================================================== */

.spindle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.spindle-card {
    padding: 22px;

    background-color: #f7f9fc;

    border: 1px solid #d6e0e8;
    border-radius: 10px;
}

.spindle-card h3 {
    margin-bottom: 20px;

    font-size: 21px;
    color: #1f4e79;
}
.clamping-field-list {
    display: grid;
    gap: 16px;
}

.inline-option-field {
    display: grid;
    grid-template-columns: minmax(180px, 1.5fr) minmax(110px, 1fr);
    align-items: center;
    gap: 12px;
}

.inline-field-label {
    font-weight: 600;
    color: #1f4e79;
}

.inline-radio-options {
    display: flex;
    align-items: center;
    gap: 18px;
}

.inline-radio-options label {
    display: flex;
    align-items: center;
    gap: 6px;

    margin: 0;

    font-weight: 600;
    cursor: pointer;
}

.inline-radio-options input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;

    accent-color: #1f4e79;
}

.clamping-additional-information {
    margin-top: 24px;
}

/* ==================================================
   Radiobutton-Bereiche
================================================== */

.radio-field {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 28px;

    margin-top: 20px;
    padding: 16px;

    border: 1px solid #cfd8dc;
    border-radius: 8px;
}

.radio-field legend {
    padding: 0 8px;

    font-weight: 600;
    color: #1f4e79;
}

.radio-field label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;

    margin: 0;

    font-weight: 600;
    color: #2c3e50;

    cursor: pointer;
}

.radio-field input[type="radio"] {
    width: 18px;
    height: 18px;

    margin: 0;

    accent-color: #1f4e79;
}


/* ==================================================
   Version 1.5 – Abstich M7
================================================== */

.abstich-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.abstich-position {
    margin-top: 0;
}


/* ==================================================
   Version 1.5 – Werkstückausgabe
================================================== */

.output-options {
    margin-top: 0;
}


/* ==================================================
   Responsive Darstellung
================================================== */

@media (max-width: 1100px) {
    .abstich-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .spindle-grid,
    .abstich-grid {
        grid-template-columns: 1fr;
    }
}


/* ==================================================
   Druckdarstellung
================================================== */

@media print {
    .spindle-card {
        background-color: white;
        break-inside: avoid;
    }

    #abstich-m7,
    #werkstueckausgabe {
        break-inside: avoid;
    }
}
/* ==================================================
   Version 1.6.0
   Werkzeugkarten
================================================== */

.tool-columns{

    display:grid;

    grid-template-columns:1fr 1fr;

    gap:30px;

}

.tool-column-heading{

    display:flex;

    justify-content:space-between;

    align-items:center;

    margin-bottom:20px;

}

.tool-column-heading h3{

    color:#1f4e79;

    font-size:24px;

}

.add-tool-button{

    padding:10px 18px;

    border:none;

    border-radius:8px;

    cursor:pointer;

    background:#1f4e79;

    color:white;

    font-weight:bold;

}

.add-tool-button:hover{

    background:#2f6ba1;

}

.tool-list{

    display:flex;

    flex-direction:column;

    gap:20px;

}

.tool-card{

    background:#f7f9fc;

    border:1px solid #d7dfe8;

    border-radius:10px;

    padding:18px;

}

.tool-card-heading{

    display:flex;

    justify-content:space-between;

    align-items:center;

    margin-bottom:18px;

}

.remove-tool-button{

    border:none;

    background:#d9534f;

    color:white;

    padding:6px 12px;

    border-radius:6px;

    cursor:pointer;

}

.remove-tool-button:hover{

    background:#bb2d3b;

}

/* erste Zeile */

.tool-top-row{

    display:flex;

    align-items:flex-end;

    gap:20px;

    margin-bottom:18px;

}

.short-tool-field{

    display:flex;

    align-items:center;

    gap:8px;

}

.short-tool-field span{

    font-weight:bold;

    color:#1f4e79;

}

.short-tool-field input{

    width:90px;

}

/* X+ X- */

.tool-direction{

    display:flex;

    gap:20px;

    align-items:center;

    margin:0;

    padding:8px 14px;

    border:1px solid #d7dfe8;

    border-radius:8px;

}

.tool-direction legend{

    padding:0 6px;

    color:#1f4e79;

    font-weight:bold;

}

.tool-direction label{

    display:flex;

    align-items:center;

    gap:6px;

}

/* Tablet */

@media(max-width:1000px){

.tool-columns{

grid-template-columns:1fr;

}

}/* ==================================================
   Version 1.6.1
   Kompakte Werkzeugkarten
================================================== */

.tool-card {
    padding: 14px;
}

.tool-card-heading {
    margin-bottom: 10px;
}

.tool-card-title {
    font-size: 14px;
    color: #607080;
}

/* Papierkorb */

.remove-tool-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;
    padding: 0;

    font-size: 17px;

    color: #8b1e1e;
    background: transparent;

    border: 1px solid transparent;
    border-radius: 6px;
}

.remove-tool-button:hover {
    color: white;
    background: #bb2d3b;
}

/* T, S und X-Richtung */

.tool-top-row {
    display: grid;
    grid-template-columns:
        minmax(150px, 1.5fr)
        minmax(90px, 0.7fr)
        minmax(200px, 1.5fr);

    align-items: end;
    gap: 14px;

    margin-bottom: 12px;
}

.short-tool-field {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
}

.short-tool-field span {
    font-size: 25px;
    font-weight: 800;
    line-height: 1;
    color: #1f4e79;
}

.short-tool-field input {
    width: 100%;
    min-width: 0;
    height: 42px;

    padding: 7px 10px;

    font-size: 20px;
    font-weight: 700;
}

.cutting-position-field input {
    font-size: 20px;
}

/* X+ und X− kompakt in derselben Zeile */

.tool-direction {
    display: flex;
    align-items: center;
    gap: 14px;

    min-height: 42px;
    margin: 0;
    padding: 7px 11px;
}

.tool-direction legend {
    font-size: 12px;
}

.tool-direction label {
    gap: 5px;
    font-size: 14px;
}

/* Kompakte Beschriftungen */

.compact-tool-field {
    margin-top: 9px;
}

.compact-tool-field label,
.tool-card > .form-field label {
    margin-bottom: 4px;

    font-size: 12px;
    font-weight: 600;
    color: #667788;
}

.tool-card .form-field input,
.tool-card .form-field textarea {
    padding: 8px 9px;
}

.tool-card .form-field input {
    height: 38px;
}

.tool-card .tool-remarks {
    min-height: 58px;
    height: 58px;
}

/* Kleinere Bildschirme */

@media (max-width: 1250px) {
    .tool-top-row {
        grid-template-columns: minmax(130px, 1fr) minmax(80px, 0.6fr);
    }

    .tool-direction {
        grid-column: 1 / -1;
    }
}

@media (max-width: 650px) {
    .tool-top-row {
        grid-template-columns: 1fr;
    }

    .tool-direction {
        grid-column: auto;
    }
}
/* ==================================================
   Version 1.6.2 – Werkzeugbibliothek
================================================== */

.tool-card-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;
    padding: 0;

    font-size: 17px;

    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;

    cursor: pointer;
}

.library-load-button:hover,
.library-save-button:hover {
    background: #dbe8f5;
    border-color: #b8ccdc;
}

.remove-tool-button:hover {
    color: white;
    background: #bb2d3b;
}


/* ==================================================
   Modalfenster
================================================== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(20, 32, 45, 0.65);
}

.modal.is-open {
    display: flex;
}

.modal-window {
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);

    overflow-y: auto;

    background: white;

    border-radius: 12px;

    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.library-window {
    width: min(800px, 100%);
}

.modal-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 18px 22px;

    color: white;
    background: #1f4e79;

    border-radius: 12px 12px 0 0;
}

.modal-heading h2 {
    margin: 0;
    font-size: 22px;
}

.modal-close-button {
    width: 34px;
    height: 34px;
    padding: 0;

    font-size: 26px;
    line-height: 1;

    color: white;
    background: transparent;

    border: none;
    border-radius: 6px;

    cursor: pointer;
}

.modal-close-button:hover {
    background: rgba(255, 255, 255, 0.18);
}

.modal-content {
    display: grid;
    gap: 18px;

    padding: 22px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;

    padding: 16px 22px;

    background: #f5f7f9;

    border-radius: 0 0 12px 12px;
}

.modal-footer button {
    padding: 10px 16px;

    color: white;
    background: #1f4e79;

    border: none;
    border-radius: 6px;

    cursor: pointer;
}

.modal-footer .secondary-button {
    color: #2c3e50;
    background: #dfe5ea;
}


/* ==================================================
   Werkzeugbibliothek
================================================== */

.library-filters {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;

    padding: 22px;
    padding-bottom: 14px;
}

.library-list {
    display: flex;
    flex-direction: column;
    gap: 10px;

    min-height: 150px;
    max-height: 430px;

    padding: 0 22px 22px;

    overflow-y: auto;
}

.library-empty-message {
    padding: 30px 15px;

    text-align: center;
    color: #71808e;

    border: 1px dashed #c9d3db;
    border-radius: 8px;
}

.library-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;

    padding: 14px;

    background: #f7f9fc;

    border: 1px solid #d7dfe8;
    border-radius: 8px;
}

.library-item:hover {
    border-color: #1f4e79;
}

.library-item h3 {
    margin: 0 0 5px;

    font-size: 17px;
    color: #1f4e79;
}

.library-item p {
    margin: 3px 0;

    font-size: 14px;
    color: #536474;
}

.library-item-category {
    display: inline-block;

    margin-top: 5px;
    padding: 3px 8px;

    font-size: 12px;
    font-weight: 600;

    color: #1f4e79;
    background: #dbe8f5;

    border-radius: 20px;
}

.library-use-button {
    align-self: center;

    padding: 9px 13px;

    color: white;
    background: #1f4e79;

    border: none;
    border-radius: 6px;

    cursor: pointer;
}

@media (max-width: 650px) {
    .library-filters {
        grid-template-columns: 1fr;
    }

    .library-item {
        grid-template-columns: 1fr;
    }

    .library-use-button {
        justify-self: start;
    }
}

@media print {
    .modal,
    .tool-card-actions {
        display: none !important;
    }
}
/* ==================================================
   Version 1.6.3 – Erweiterte Werkzeugstammdaten
================================================== */

.library-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.full-width-field {
    grid-column: 1 / -1;
}

.library-item-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 18px;

    margin-top: 10px;
}

.library-item-details p {
    margin: 0;
}

.library-item-dates {
    margin-top: 10px;

    font-size: 12px;
    color: #778692;
}

.library-stock-warning {
    color: #a33522 !important;
    font-weight: 700;
}

.library-product-link {
    display: inline-block;

    margin-top: 8px;

    color: #1f4e79;
    font-size: 13px;
    font-weight: 600;
}

@media (max-width: 650px) {
    .library-details-grid,
    .library-item-details {
        grid-template-columns: 1fr;
    }

    .full-width-field {
        grid-column: auto;
    }
}
/* ==================================================
   Version 1.6.4 – Bibliotheksübersicht
================================================== */

.section-heading-with-action {
    justify-content: space-between;
}

.section-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.library-overview-button {
    padding: 10px 16px;

    font-weight: 700;
    color: white;
    background: #1f4e79;

    border: none;
    border-radius: 7px;

    cursor: pointer;
}

.library-overview-button:hover {
    background: #2f6ba1;
}

.library-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.library-edit-button,
.library-delete-button {
    padding: 8px 12px;

    color: white;

    border: none;
    border-radius: 6px;

    cursor: pointer;
}

.library-edit-button {
    background: #1f4e79;
}

.library-delete-button {
    background: #b83232;
}

.library-count {
    margin: 0 22px 14px;

    font-size: 14px;
    font-weight: 600;
    color: #607080;
}

@media (max-width: 700px) {
    .section-heading-with-action {
        align-items: flex-start;
        flex-direction: column;
    }

    .library-overview-button {
        width: 100%;
    }
}
/* ==================================================
   Version 1.6.4a – Bibliotheksbutton
================================================== */

.section-heading-with-action {
    justify-content: space-between;
}

.section-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.library-overview-button {
    padding: 10px 16px;

    font-weight: 700;
    color: white;
    background: #1f4e79;

    border: none;
    border-radius: 7px;

    cursor: pointer;
}

.library-overview-button:hover {
    background: #2f6ba1;
}

@media (max-width: 700px) {
    .section-heading-with-action {
        align-items: flex-start;
        flex-direction: column;
    }

    .library-overview-button {
        width: 100%;
    }
 /* ==================================================
   Version 2.3.0 – Kompakte PDF-Druckansicht
================================================== */

@page {
    size: 148mm 210mm;
    margin: 5mm;
}

@media print {

    html,
    body {
        width: 100%;
        margin: 0;
        padding: 0;

        font-size: 9pt;
        color: #000;
        background: #fff;

        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .app-header {
        display: flex;
        align-items: center;
        justify-content: space-between;

        margin: 0 0 4mm;
        padding: 3mm 4mm;

        color: #000;
        background: #fff;

        border: 1px solid #777;
        border-radius: 0;
    }

    .header-title h1 {
        margin: 0 0 1mm;
        font-size: 18pt;
        line-height: 1.1;
        color: #000;
    }

    .header-title p {
        margin: 0;
        font-size: 9pt;
        color: #000;
    }

    .header-information {
        display: block;
    }

    .version {
        font-size: 8pt;
        color: #000;
    }

    .header-button,
    .library-overview-button,
    .add-tool-button,
    .tool-card-actions,
    .modal {
        display: none !important;
    }

    .page-container {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .card {
        margin: 0 0 3mm;
        padding: 3.5mm;

        background: #fff;

        border: 1px solid #888;
        border-radius: 0;
        box-shadow: none;
    }

    .card[hidden],
    [data-machine-field][hidden],
    [data-machine-spindle][hidden],
    .tool-column[hidden] {
        display: none !important;
    }

    .section-heading {
        gap: 2mm;
        margin-bottom: 3mm;
    }

    .section-heading h2 {
        font-size: 13pt;
        line-height: 1.1;
        color: #000;
    }

    .section-number {
        width: 7mm;
        height: 7mm;

        font-size: 9pt;
        color: #fff;
        background: #333;

        border-radius: 1mm;
    }

    .form-grid,
    .stangenlader-grid,
    .torque-grid,
    .spindle-grid,
    .abstich-grid {
        gap: 2mm 4mm;
    }

    .order-data-grid,
    .stangenlader-grid,
    .torque-grid,
    .spindle-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .form-field label,
    .inline-field-label {
        margin-bottom: 1mm;

        font-size: 8pt;
        line-height: 1.1;
        color: #000;
    }

    .inline-form-field,
    .inline-option-field {
        grid-template-columns:
            minmax(34mm, 1.5fr)
            minmax(22mm, 1fr);

        gap: 2mm;
    }

    .form-field input,
    .form-field select,
    .form-field textarea {
        padding: 1.2mm 1.5mm;

        font-size: 8.5pt;
        line-height: 1.1;
        color: #000;
        background: #fff;

        border: 1px solid #777;
        border-radius: 0;
        box-shadow: none;
    }

    .form-field input,
    .form-field select {
        height: 7mm;
    }

    .form-field textarea {
        min-height: 12mm;
        resize: none;
    }

    .subsection {
        margin-top: 3mm;
        padding-top: 3mm;

        border-top: 1px solid #999;
    }

    .subsection h3,
    .spindle-card h3,
    .tool-column-heading h3 {
        margin: 0 0 2mm;

        font-size: 10pt;
        color: #000;
    }

    .spindle-card {
        padding: 3mm;

        background: #fff;

        border: 1px solid #999;
        border-radius: 0;

        break-inside: avoid;
    }

    .clamping-field-list {
        gap: 2mm;
    }

    .clamping-additional-information,
    .remarks-field {
        margin-top: 3mm;
    }

    .radio-field {
        gap: 2mm 5mm;

        margin-top: 0;
        padding: 2mm;

        border: 1px solid #888;
        border-radius: 0;
    }

    .radio-field legend {
        padding: 0 1mm;

        font-size: 8pt;
        color: #000;
    }

    .radio-field label,
    .inline-radio-options label {
        font-size: 8pt;
        color: #000;
    }

    .radio-field input[type="radio"],
    .inline-radio-options input[type="radio"] {
        width: 4mm;
        height: 4mm;
    }

    #auftragsdaten,
    #stangenlader,
    #spannmittel,
    #abstich-m7,
    #werkstueckausgabe {
        break-inside: avoid;
    }

    .tool-columns {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 4mm;
    }

    .tool-column-heading {
        margin-bottom: 2mm;
    }

    .tool-list {
        gap: 2mm;
    }

    .tool-card {
        padding: 2.5mm;

        background: #fff;

        border: 1px solid #888;
        border-radius: 0;

        break-inside: avoid;
    }

    .tool-card-heading {
        margin-bottom: 1.5mm;
    }

    .tool-card-title {
        font-size: 8pt;
        color: #000;
    }

    .tool-top-row {
        grid-template-columns:
            minmax(22mm, 1fr)
            minmax(18mm, 0.8fr)
            minmax(35mm, 1.5fr);

        gap: 2mm;
        margin-bottom: 1.5mm;
    }

    .tool-top-row input,
    .tool-card .form-field input {
        height: 6mm;
        padding: 1mm;
        font-size: 8pt;
    }

    .tool-card > .form-field {
        margin-top: 1.5mm;
    }

    .tool-card > .form-field label {
        margin-bottom: 0.5mm;
        font-size: 7.5pt;
    }

    .tool-card .tool-remarks {
        min-height: 8mm;
        height: 8mm;
    }

} 
}
/* ==================================================
   Version 2.3.1 – Kopfbereich
================================================== */

.app-header {
    align-items: center;
    text-align: left;
}

.header-title {
    flex-shrink: 0;
    text-align: left;
}

.header-title h1 {
    margin: 0 0 3px;

    font-size: 22px;
    line-height: 1.1;
}

.header-title p {
    margin: 0;

    font-size: 14px;
    line-height: 1.2;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;

    min-width: 0;
    margin-left: auto;

    text-align: right;
}

.selected-machine {
    display: flex;
    flex-direction: column;
    align-items: flex-end;

    min-width: 0;
    text-align: right;
}

.selected-machine-label {
    margin-bottom: 3px;

    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.08em;

    opacity: 0.8;
}

.selected-machine-name {
    font-size: 34px;
    line-height: 1.05;

    overflow-wrap: anywhere;
}

.header-information {
    justify-content: flex-end;
}

.version {
    padding: 3px 6px;

    font-size: 9px;
    font-weight: 600;

    color: white;
    background: transparent;

    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
}

@media (max-width: 800px) {

    .header-right {
        align-items: flex-end;
        width: 100%;
        margin-left: 0;
    }

    .selected-machine-name {
        font-size: 27px;
    }

}


/* Kopfbereich in der PDF */

@media print {

    .app-header {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: end;
        gap: 6mm;

        padding: 2.5mm 3mm;
        text-align: left;
    }

    .header-title h1 {
        margin: 0 0 0.5mm;

        font-size: 9pt;
        line-height: 1;
    }

    .header-title p {
        margin: 0;

        font-size: 7pt;
        line-height: 1;
    }

    .header-right {
        align-items: flex-end;
        gap: 1mm;

        margin-left: 0;
        text-align: right;
    }

    .selected-machine {
        align-items: flex-end;
        text-align: right;
    }

    .selected-machine-label {
        margin-bottom: 0.5mm;

        font-size: 6pt;
        color: #000;
    }

    .selected-machine-name {
        font-size: 16pt;
        line-height: 1;
        color: #000;
    }

    .header-information {
        display: block;
    }

    .version {
        padding: 0;

        font-size: 6pt;
        font-weight: 400;
        color: #000;
        background: transparent;

        border: none;
    }

}
/* ==================================================
   Version 2.3.2 – Sichere Seitenumbrüche
================================================== */

@media print {

    #auftragsdaten,
    #stangenlader,
    #spannmittel,
    #abstich-m7,
    #werkstueckausgabe {
        break-inside: avoid-page;
        page-break-inside: avoid;
    }

    .spindle-card,
    .tool-card {
        break-inside: avoid-page;
        page-break-inside: avoid;
    }

    .section-heading,
    .tool-column-heading,
    .tool-card-heading {
        break-after: avoid-page;
        page-break-after: avoid;
    }

    .tool-columns {
        align-items: start;
    }

    .tool-list {
        display: block;
    }

    .tool-card {
        margin-bottom: 2mm;
    }

    .tool-card:last-child {
        margin-bottom: 0;
    }

    #werkzeuge {
        break-inside: auto;
        page-break-inside: auto;
    }

}
/* ==================================================
   Version 2.3.3 – Erste PDF-Seite
================================================== */

@media print {

    .app-header {
        margin-bottom: 2mm;
    }

    #auftragsdaten {
        margin-top: 0;
        margin-bottom: 2mm;
        padding: 2.5mm;

        break-before: avoid-page;
        page-break-before: avoid;

        break-inside: avoid-page;
        page-break-inside: avoid;
    }

    #auftragsdaten .section-heading {
        margin-bottom: 2mm;
    }

    #auftragsdaten .section-heading h2 {
        font-size: 11pt;
    }

    #auftragsdaten .section-number {
        width: 6mm;
        height: 6mm;
        font-size: 8pt;
    }

    #auftragsdaten .order-data-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 1.5mm 3mm;
    }

    #auftragsdaten .form-field label {
        margin-bottom: 0.5mm;
        font-size: 7pt;
    }

    #auftragsdaten .form-field input,
    #auftragsdaten .form-field select {
        height: 6mm;
        padding: 0.8mm 1mm;

        font-size: 7.5pt;
    }

}
/* ==================================================
   Version 2.3.5 – Kompakter Werkzeugkopf
================================================== */

@media screen {

    .tool-top-row {
        grid-template-columns:
            minmax(145px, 1.4fr)
            minmax(65px, 0.45fr)
            minmax(145px, 0.9fr);

        gap: 10px;
    }

    /* T – Toolnummer bleibt hervorgehoben */

    .short-tool-field:not(.cutting-position-field) span {
        font-size: 25px;
    }

    .short-tool-field:not(.cutting-position-field) input {
        font-size: 20px;
        font-weight: 700;
    }

    /* S – Schneidenlage kleiner darstellen */

    .cutting-position-field span {
        font-size: 17px;
        font-weight: 700;
    }

    .cutting-position-field input {
        height: 36px;

        padding: 6px 8px;

        font-size: 15px;
        font-weight: 600;
    }

    /* X+ und X− kompakter darstellen */

    .tool-direction {
        gap: 10px;

        min-height: 36px;
        margin: 0;
        padding: 5px 8px;
    }

    .tool-direction legend {
        padding: 0 4px;

        font-size: 10px;
    }

    .tool-direction label {
        gap: 4px;

        font-size: 12px;
    }

    .tool-direction input[type="radio"] {
        width: 14px;
        height: 14px;
        margin: 0;
    }

}


@media screen and (max-width: 1250px) {

    .tool-top-row {
        grid-template-columns:
            minmax(130px, 1fr)
            minmax(65px, 0.45fr);
    }

    .tool-direction {
        grid-column: 1 / -1;
    }

}


@media screen and (max-width: 650px) {

    .tool-top-row {
        grid-template-columns: 1fr;
    }

    .tool-direction {
        grid-column: auto;
    }

}
/* ==================================================
   Version 2.3.6 – Toolnummer und Schneidenlage
================================================== */

@media screen {

    .tool-top-row {
        grid-template-columns:
            minmax(130px, 1.4fr)
            minmax(48px, 0.3fr)
            minmax(140px, 0.9fr);
    }

    /* T ohne sichtbaren Eingaberahmen */

    .short-tool-field:not(.cutting-position-field) input {
        border: none;
        border-radius: 0;
        outline: none;
        background: transparent;
        box-shadow: none;
    }

    .short-tool-field:not(.cutting-position-field) input:focus {
        background: rgba(31, 78, 121, 0.06);
    }

    /* S nur für eine Ziffer */

    .cutting-position-field {
        grid-template-columns: auto 38px;
        justify-content: start;
    }

    .cutting-position-field input {
        width: 38px;
        min-width: 38px;
        max-width: 38px;

        padding: 5px;

        text-align: center;
    }

}


@media screen and (max-width: 1250px) {

    .tool-top-row {
        grid-template-columns:
            minmax(120px, 1fr)
            minmax(48px, 0.3fr);
    }

}


@media screen and (max-width: 650px) {

    .tool-top-row {
        grid-template-columns: 1fr;
    }

}


/* Gleiche Anpassung in der PDF */

@media print {

    .short-tool-field:not(.cutting-position-field) input {
        border: none !important;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .cutting-position-field {
        grid-template-columns: auto 8mm;
        justify-content: start;
    }

    .cutting-position-field input {
        width: 8mm;
        min-width: 8mm;
        max-width: 8mm;

        padding: 0.5mm;

        text-align: center;
    }

}
/* ==================================================
   Version 2.3.7 – Kompakte X-Richtung
================================================== */

@media screen {

    .tool-top-row {
        grid-template-columns:
            minmax(130px, 1.4fr)
            minmax(48px, 0.3fr)
            minmax(100px, 0.6fr);
    }

    .tool-direction {
        width: max-content;
        max-width: 100%;
        min-height: 26px;

        justify-self: start;

        gap: 6px;
        margin: 0;
        padding: 2px 4px;

        border: none;
        border-radius: 0;
    }

    .tool-direction legend {
        margin: 0;
        padding: 0 2px;

        font-size: 8px;
        line-height: 1;
    }

    .tool-direction label {
        gap: 2px;

        font-size: 10px;
        line-height: 1;
    }

    .tool-direction input[type="radio"] {
        width: 11px;
        height: 11px;
        margin: 0;
    }

}


@media screen and (max-width: 1250px) {

    .tool-top-row {
        grid-template-columns:
            minmax(120px, 1fr)
            minmax(48px, 0.3fr);
    }

    .tool-direction {
        grid-column: 1 / -1;
    }

}


@media screen and (max-width: 650px) {

    .tool-top-row {
        grid-template-columns: 1fr;
    }

    .tool-direction {
        grid-column: auto;
    }

}


/* Kompakte X-Richtung in der PDF */

@media print {

    .tool-direction {
        width: max-content;
        max-width: 100%;
        min-height: 0;

        justify-self: start;

        gap: 1.5mm;
        margin: 0;
        padding: 0.5mm;

        border: none;
    }

    .tool-direction legend {
        padding: 0 0.5mm;

        font-size: 5pt;
        line-height: 1;
    }

    .tool-direction label {
        gap: 0.5mm;

        font-size: 5.5pt;
        line-height: 1;
    }

    .tool-direction input[type="radio"] {
        width: 2.5mm;
        height: 2.5mm;
        margin: 0;
    }

}
/* ==================================================
   Version 2.3.8 – Kompakter Abstich M7
================================================== */

@media print {

    #abstich-m7 {
        margin-bottom: 2mm;
        padding: 2.5mm;
    }

    #abstich-m7 .section-heading {
        margin-bottom: 2mm;
    }

    #abstich-m7 .section-heading h2 {
        font-size: 11pt;
    }

    #abstich-m7 .section-number {
        width: 6mm;
        height: 6mm;

        font-size: 8pt;
    }

    #abstich-m7 .abstich-grid {
        grid-template-columns:
            repeat(4, minmax(0, 1fr));

        gap: 1.5mm 2mm;
    }

    #abstich-m7 .form-field label {
        margin-bottom: 0.5mm;

        font-size: 6.5pt;
        line-height: 1;
    }

    #abstich-m7 .form-field input {
        height: 5.5mm;
        padding: 0.6mm 0.8mm;

        font-size: 7pt;
    }

    #abstich-m7 .abstich-position {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 1mm 2mm;

        min-width: 0;
        margin: 0;
        padding: 1mm;

        border: 1px solid #888;
    }

    #abstich-m7 .abstich-position legend {
        padding: 0 0.5mm;

        font-size: 6pt;
        line-height: 1;
    }

    #abstich-m7 .abstich-position label {
        gap: 0.5mm;

        font-size: 6pt;
        line-height: 1;
    }

    #abstich-m7 .abstich-position input[type="radio"] {
        width: 2.5mm;
        height: 2.5mm;
        margin: 0;
    }

}

/* ==================================================
   Version 2.4.2 – Setup speichern
================================================== */

.setup-save-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 14px;

    color: #1f4e79;
    background: #eef4f9;

    border: 1px solid #c8d8e5;
    border-radius: 7px;
}

.setup-save-summary span {
    font-size: 13px;
    font-weight: 600;
}

.setup-save-summary strong {
    text-align: right;
}

.setup-save-note {
    margin: 0;

    font-size: 13px;
    line-height: 1.5;
    color: #687886;
}

@media print {

    #save-setup-modal,
    #save-setup-button {
        display: none !important;
    }

}
/* ==================================================
   Version 2.4.2 – Kompakter Kopfbereich
================================================== */

.app-header {
    padding: 20px 30px;
    gap: 20px;
}

.header-title {
    flex: 0 0 auto;
}

.header-right {
    flex: 1 1 auto;
    min-width: 0;
}

.header-information {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 7px;
}

.header-button {
    min-height: 32px;
    padding: 6px 10px;

    font-size: 12px;
    line-height: 1;
    white-space: nowrap;

    border-radius: 6px;
}

.version {
    padding: 3px 5px;
    white-space: nowrap;
}

@media (max-width: 900px) {

    .app-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-title {
        width: 100%;
    }

    .header-right {
        align-items: flex-end;
        width: 100%;
        margin-left: 0;
    }

    .selected-machine-name {
        font-size: 27px;
    }

    .header-information {
        flex-wrap: wrap;
    }
}

@media print {

    .header-button {
        display: none !important;
    }
}
/* ==================================================
   Version 2.4.3 – Setupübersicht
================================================== */

.setup-overview-window {
    width: min(900px, calc(100% - 30px));
}

.setup-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.setup-list-item {
    padding: 16px;

    background: #f6f9fc;
    border: 1px solid #cbd8e5;
    border-radius: 8px;
}

.setup-list-item h3 {
    margin: 0 0 5px;

    color: #1f4e79;
    font-size: 18px;
}

.setup-list-machine {
    display: block;
    margin-bottom: 12px;

    color: #222;
    font-size: 15px;
}

.setup-list-details {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 8px 16px;
}

.setup-list-details div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.setup-list-details span {
    color: #667788;
    font-size: 11px;
}

.setup-list-details strong {
    overflow-wrap: anywhere;
    font-size: 13px;
}

.setup-list-empty {
    padding: 25px;
    text-align: center;

    color: #667788;
    background: #f6f9fc;
    border-radius: 8px;
}

@media (max-width: 700px) {

    .setup-list-details {
        grid-template-columns: 1fr 1fr;
    }
}

@media print {

    #open-setup-modal,
    #open-setup-button {
        display: none !important;
    }
}
/* ==================================================
   Version 2.4.4 – Gespeicherte Setups laden
================================================== */

.setup-list-actions {
    display: flex;
    justify-content: flex-end;

    margin-top: 14px;
    padding-top: 12px;

    border-top: 1px solid #d6e0e9;
}

.setup-load-button {
    padding: 8px 14px;

    font-size: 13px;
    font-weight: 700;

    color: white;
    background: #1f4e79;

    border: none;
    border-radius: 6px;

    cursor: pointer;
}

.setup-load-button:hover {
    background: #163b5e;
}

@media print {

    .setup-list-actions {
        display: none !important;
    }
}
/* ==================================================
   Version 2.4.5 – Aktuell geöffnetes Setup
================================================== */

.active-setup-indicator {
    display: block;
    max-width: 100%;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 11px;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.8);
}

@media print {

    .active-setup-indicator {
        display: none !important;
    }
}
/* ==================================================
   Version 2.4.6 – Setup als Variante speichern
================================================== */

#save-setup-modal .modal-footer {
    flex-wrap: wrap;
}

#save-as-new-setup[hidden] {
    display: none;
}
/* ==================================================
   Version 2.4.7 – Setups löschen
================================================== */

.setup-list-actions {
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.setup-delete-button {
    padding: 8px 14px;

    font-size: 13px;
    font-weight: 700;

    color: #a12622;
    background: #fff;

    border: 1px solid #c84a43;
    border-radius: 6px;

    cursor: pointer;
}

.setup-delete-button:hover {
    color: #fff;
    background: #b73530;
}
/* ==================================================
   Version 2.4.8 – Setup-Dateien exportieren
================================================== */

.setup-overview-footer {
    justify-content: space-between;
}

.setup-export-button {
    padding: 8px 14px;

    font-size: 13px;
    font-weight: 700;

    color: #1f4e79;
    background: #fff;

    border: 1px solid #1f4e79;
    border-radius: 6px;

    cursor: pointer;
}

.setup-export-button:hover {
    background: #e9f1f8;
}

@media (max-width: 600px) {

    .setup-list-actions {
        flex-wrap: wrap;
    }

    .setup-overview-footer {
        gap: 10px;
    }
}
/* ==================================================
   Version 2.4.9 – Setup-Dateien importieren
================================================== */

.setup-backup-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 650px) {

    .setup-overview-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .setup-backup-actions {
        align-items: stretch;
        flex-direction: column;
    }
}
/* ==================================================
   Version 2.5.1 – Setup-Bilder
================================================== */

.setup-image-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.setup-image-add-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 9px 15px;

    font-weight: 700;
    color: #fff;
    background: #1f4e79;

    border-radius: 6px;
    cursor: pointer;
}

.setup-image-add-button:hover {
    background: #163b5e;
}

.setup-image-add-button.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

#setup-image-count {
    color: #526579;
    font-size: 13px;
    font-weight: 700;
}

.setup-image-note {
    margin: 10px 0 18px;
    color: #667788;
    font-size: 13px;
}

.setup-image-gallery {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 16px;

    margin-bottom: 20px;
}

.setup-image-preview {
    overflow: hidden;

    background: #f5f8fb;
    border: 1px solid #cad7e3;
    border-radius: 8px;
}

.setup-image-preview img {
    display: block;
    width: 100%;
    height: 220px;

    object-fit: contain;
    background: #e8eef4;

    cursor: zoom-in;
}

.setup-image-remove-button {
    width: 100%;
    padding: 8px;

    font-weight: 700;
    color: #a12622;
    background: #fff;

    border: none;
    border-top: 1px solid #cad7e3;

    cursor: pointer;
}

.setup-image-remove-button:hover {
    color: #fff;
    background: #b73530;
}

.setup-image-print-choice {
    display: flex;
    align-items: center;
    gap: 18px;

    margin: 0;
    padding: 12px 14px;

    border: 1px solid #cad7e3;
    border-radius: 8px;
}

.setup-image-print-choice legend {
    padding: 0 6px;
    font-weight: 700;
    color: #1f4e79;
}

.setup-image-print-choice label {
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 800px) {

    .setup-image-gallery {
        grid-template-columns: 1fr;
    }

    .setup-image-preview img {
        height: auto;
        max-height: 420px;
    }
}

@media print {

    #bilder:not(.print-images-enabled) {
        display: none !important;
    }

    #bilder.print-images-enabled {
        break-before: page;
        page-break-before: always;
    }

    #bilder .setup-image-controls,
    #bilder .setup-image-note,
    #bilder .setup-image-print-choice,
    #bilder .setup-image-remove-button {
        display: none !important;
    }

    #bilder .setup-image-gallery {
        display: block;
        margin: 0;
    }

    #bilder .setup-image-preview {
        margin-bottom: 4mm;

        border: none;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    #bilder .setup-image-preview img {
        width: 100%;
        height: auto;
        max-height: 175mm;

        object-fit: contain;
        background: transparent;
    }
}

