body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f7f6; color: #333; padding: 5px; margin: 0; font-size: 14px; }
.container { max-width: 800px; margin: 0 auto; background: #fff; padding: 5px 10px; border-radius: 6px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); position: relative; }
h1 { text-align: center; color: #2c3e50; margin-top: 0; margin-bottom: 4px; font-size: 1.8em; }
.header-info { text-align: center; margin-bottom: 8px; color: #444; font-size: 1.05em; line-height: 1.3; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 5px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 5px; }
.grid-ersatz-zeit { display: grid; grid-template-columns: 6.5fr 3.5fr; gap: 8px; margin-bottom: 5px; }
.form-group { display: flex; flex-direction: column; margin-bottom: 3px; }
label { font-weight: bold; margin-bottom: 1px; font-size: 0.75em; color: #2c3e50; text-transform: uppercase; }
input[type="text"], input[type="tel"], input[type="email"], input[type="date"], input[type="number"], textarea, select { box-sizing: border-box; width: 100%; padding: 3px 5px; border: 1px solid #ccd1d9; border-radius: 3px; font-size: 0.9em; background-color: #fafafa; }
input:focus, textarea:focus, select:focus { border-color: #3498db; outline: none; background-color: #fff; }
input:required { border-left: 2px solid #e74c3c; } 
textarea { resize: vertical; min-height: 35px; white-space: pre-wrap !important; overflow-wrap: break-word !important; }
fieldset { border: 1px solid #e1e4e8; padding: 5px 8px; margin-bottom: 5px; border-radius: 4px; background-color: #fcfcfc; page-break-inside: avoid; }
legend { font-weight: bold; padding: 2px 6px; color: #000000; background-color: #e4e7eb; border: 1px solid #ccd1d9; border-radius: 3px; font-size: 0.9em; line-height: 1.3; }
table { width: 100%; border-collapse: collapse; margin-bottom: 2px; }
th, td { border: 1px solid #e1e4e8; padding: 2px 4px; text-align: left; }
th { background-color: #ecf0f1; font-size: 0.75em; color: #2c3e50; text-transform: uppercase; font-weight: bold; }
.table-input { width: 100%; box-sizing: border-box; border: none; background: transparent; padding: 2px; font-size: 0.9em; }
.table-input:focus { border-bottom: 1px solid #3498db; outline: none; }
.kompakt-container { align-items: start; } 
.kompakt-container th { font-size: 0.75em; padding: 3px; color: #000; }
.kompakt-container td { padding: 2px; height: 22px; }
.kompakt-container .table-input { font-size: 0.85em; padding: 2px; }
.kompakt-container select.table-input { font-size: 0.8em; padding: 0px 1px; }
.btn-group { display: flex; gap: 10px; margin-top: 5px; flex-wrap: wrap; }
.submit-btn { background-color: #27ae60; color: white; padding: 8px 15px; border: none; border-radius: 4px; cursor: pointer; font-size: 0.95em; font-weight: bold; flex: 1; transition: background 0.3s; min-width: 150px; }
.submit-btn:hover { background-color: #219150; }
.save-btn { background-color: #3498db; }
.save-btn:hover { background-color: #2980b9; }
.pdf-btn { background-color: #e67e22; }
.pdf-btn:hover { background-color: #d35400; }
.cloud-btn { background-color: #8e44ad; }
.cloud-btn:hover { background-color: #732d91; }
.load-btn { background-color: #2980b9; }
.load-btn:hover { background-color: #1f618d; }
.clear-btn { background-color: #c0392b; flex: none; width: 100%; margin-top: 10px;}
.clear-btn:hover { background-color: #a53125; }
.stempeluhr-container { background: #e8f8f5; padding: 3px 6px; margin-bottom: 4px; border-radius: 3px; border: 1px solid #a3e4d7; display: flex; align-items: center; gap: 6px; font-size: 0.8em; }
.canvas-container { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.sig-canvas { border: 1px dashed #7f8c8d; background-color: #fafafa; border-radius: 3px; cursor: crosshair; touch-action: none; width: 100%; height: 70px; }
.sig-buttons { display: flex; gap: 5px; }
.btn-small { padding: 3px 8px; font-size: 0.8em; cursor: pointer; border: 1px solid #ccd1d9; border-radius: 3px; background-color: #ecf0f1; color: #2c3e50; transition: background 0.2s; }
.btn-small:hover { background-color: #bdc3c7; }
.saved-sig-img { display: none; max-width: 100%; height: 70px; border: 1px solid #27ae60; border-radius: 3px; background-color: #fff; object-fit: contain; object-position: left; }
.papier-unterschrift-linie { height: 60px; border-bottom: 1px solid #2c3e50; margin-top: 10px; margin-bottom: 5px; }
.copyright { text-align: center; font-size: 0.95em; color: #7f8c8d; margin-top: 15px; padding-bottom: 5px; }
.rabatt-col { display: none; }
.show-rabatt-col .rabatt-col { display: table-cell; }
#fotoContainer { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.uploaded-foto-wrapper { position: relative; display: inline-block; width: calc(50% - 10px); box-sizing: border-box; margin-bottom: 5px; }
.uploaded-foto { width: 100%; height: auto; border: 2px solid #bdc3c7; border-radius: 4px; object-fit: contain; display: block; }
#cloudModal, #kundenModal, #ocrReviewModal, #reminderModal, #cropperModal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9999; justify-content: center; align-items: center; backdrop-filter: blur(3px); }
.modal-content { background: #fff; padding: 20px; border-radius: 8px; width: 95%; max-width: 850px; max-height: 85vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.cloud-table { width: 100%; border-collapse: collapse; margin-top: 10px; min-width: 350px; }
.cloud-table th, .cloud-table td { padding: 10px 8px; border-bottom: 1px solid #eee; text-align: left; }
.cloud-table th { background: #ecf0f1; position: sticky; top: 0; color: #2c3e50; }
.cloud-table tr:hover { background: #f9f9f9; }

@media print {
    @page { size: A4 portrait; margin: 5mm; }
    body { background-color: #fff !important; padding: 0; font-size: 13px; }
    .container { box-shadow: none; padding: 0; max-width: 100% !important; width: 100% !important; }
    .btn-group { display: none !important; } 
    .grid-2 { grid-template-columns: 1fr 1fr !important; }
    .grid-ersatz-zeit { display: flex !important; align-items: flex-start !important; gap: 8px !important; }
    .grid-ersatz-zeit > fieldset:nth-child(1) { width: 65% !important; page-break-inside: auto !important; }
    .grid-ersatz-zeit > fieldset:nth-child(2) { width: calc(35% - 8px) !important; page-break-inside: avoid !important; }
    input[type="date"]::-webkit-calendar-picker-indicator { display: none; -webkit-appearance: none; }
    input:required { border-left: 1px solid #ccd1d9; } 
    .no-print { display: none !important; }
    #zeitTable th:nth-child(4), #zeitTable td:nth-child(4) { display: none !important; }
    #ersatzteileTable th:nth-child(7), #ersatzteileTable td:nth-child(7) { display: none !important; }
    table { page-break-inside: auto !important; }
    tr { page-break-inside: avoid !important; }
    thead { display: table-header-group !important; }
    tfoot { display: table-footer-group !important; }
    legend { color: #000000 !important; background-color: #e4e7eb !important; border: 1px solid #ccd1d9 !important; border-radius: 3px !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    th { color: #000000 !important; background-color: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .grid-ersatz-zeit fieldset { background-color: transparent !important; }
    #ersatzteileTable th, #ersatzteileTable td, #zeitTable th, #zeitTable td { background-color: transparent !important; }
    .sig-buttons { display: none !important; }
    .sig-canvas { display: none !important; } 
    .saved-sig-img { display: block !important; border: none; }
    .copyright { margin-top: 10px; font-size: 0.85em; }
    .uploaded-foto-wrapper { width: 100% !important; margin-bottom: 20px !important; display: block !important; page-break-inside: avoid; }
    .uploaded-foto { border: none; max-height: 250mm; object-fit: contain; }
    .delete-foto-btn { display: none !important; }

    /* Logik für den Rechnungsdruck */
    body.print-invoice-mode #mainContainer { display: none !important; }
    body.print-invoice-mode #invoiceTemplate { display: block !important; }
    
    /* NEU: Lager Druckmodus */
    body.print-lager-mode #mainContainer,
    body.print-lager-mode #invoiceTemplate,
    body.print-lager-mode #imagePreviewModal { 
        display: none !important; 
    }
    
    body.print-lager-mode #lagerModal {
        display: block !important;
        position: relative !important;
        background: #fff !important;
        backdrop-filter: none !important;
        z-index: auto !important;
        padding: 0 !important;
    }
    
    body.print-lager-mode .modal-content {
        box-shadow: none !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    body.print-lager-mode #lagerSucheInput,
    body.print-lager-mode .cloud-table th:nth-child(6), 
    body.print-lager-mode .cloud-table td:nth-child(6),
    body.print-lager-mode button {
        display: none !important;
    }
    
    body.print-lager-mode #lagerListe {
        max-height: none !important;
        overflow: visible !important;
    }
}

@media screen and (max-width: 600px) {
    .grid-2, .grid-3, .grid-ersatz-zeit { grid-template-columns: 1fr; }
    .grid-ersatz-zeit { display: flex; flex-direction: column; }
    .grid-ersatz-zeit > fieldset { width: 100% !important; }
    .btn-group { flex-direction: column; }
    .stempeluhr-container { flex-wrap: wrap; }
    .uploaded-foto-wrapper { width: 100%; margin-bottom: 10px;}
}