*{box-sizing:border-box}body{margin:0;background:#fff8fa;color:#432c37;font:16px system-ui,-apple-system,sans-serif}main{max-width:950px;margin:auto;padding:22px}header{background:#f5dce6;border-radius:18px;padding:20px}h1{margin:0}header p{margin-bottom:0}section{background:white;border:1px solid #e9c9d6;border-radius:15px;padding:20px;margin-top:20px}input,textarea{display:block;width:100%;font:inherit;padding:12px;border:1px solid #d9b5c3;border-radius:9px;margin:10px 0}textarea{min-height:80px}button{padding:11px 15px;border:0;border-radius:9px;background:#a84f76;color:white;font-weight:650;cursor:pointer;margin:4px}nav{display:flex;flex-wrap:wrap}nav button{background:#e7b6c9;color:#4d2337}.item{border-bottom:1px solid #edd9e1;padding:12px 0}.item small{display:block;color:#806573}footer{margin-top:20px;color:#74535e;font-size:13px}

.formGrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px;margin:12px 0}.formGrid label,#customerEntry>label{display:flex;flex-direction:column;gap:4px;font-weight:600}.formGrid input{width:100%;box-sizing:border-box}.actions{display:flex;gap:10px;flex-wrap:wrap}#customerEntry{padding:16px;border:1px solid #ded6da;border-radius:12px;margin:14px 0}#customerError{color:#a22}#newCustomer{margin:10px 0}.item button{margin-left:12px}

#orderEntry{padding:16px;border:1px solid #ded6da;border-radius:12px;margin:14px 0}#orderEntry label{display:flex;flex-direction:column;gap:4px;font-weight:600}#orderEntry select{display:block;width:100%;font:inherit;padding:12px;border:1px solid #d9b5c3;border-radius:9px;margin:10px 0;background:white}#orderError{color:#a22}#newOrder{margin:10px 0}

/* V40: interne Test-Mahnschreiben, A4 mit Falzmarken */
.reminder-overlay{position:fixed;inset:0;background:#555b;z-index:9999;overflow:auto;padding:24px}
.reminder-wrap{max-width:850px;margin:auto;background:white;padding:16px}
.reminder-toolbar{display:flex;gap:12px;margin-bottom:16px}
.reminder-sheet{position:relative;box-sizing:border-box;width:210mm;min-height:297mm;padding:18mm 20mm 20mm;background:#fff;color:#111;font:12pt Arial,sans-serif;margin:auto}
.reminder-top{display:flex;justify-content:space-between;align-items:center;border-bottom:2px solid #777;padding-bottom:8mm;white-space:pre-line;text-align:right;font-size:10pt}
.reminder-top img{width:32mm;height:32mm;object-fit:contain}
.reminder-address{margin-top:15mm;height:50mm;white-space:pre-line;font-size:11pt}
.reminder-sheet h2{font-size:17pt;margin:8mm 0}
.reminder-text{white-space:pre-line;line-height:1.65}
.reminder-foot{position:absolute;bottom:16mm;left:20mm;right:20mm;border-top:1px solid #aaa;padding-top:4mm;font-size:9pt}
.reminder-fold:before,.reminder-fold:after{content:'';position:absolute;left:0;width:5mm;border-top:1px solid #555}
.reminder-fold:before{top:105mm}.reminder-fold:after{top:210mm}
@media print{body>*:not(.reminder-overlay){display:none!important}.reminder-overlay{position:static;background:white;padding:0;overflow:visible}.reminder-wrap{padding:0;max-width:none}.reminder-toolbar{display:none!important}.reminder-sheet{margin:0;width:210mm;min-height:297mm;break-after:avoid}@page{size:A4;margin:0}}

.reminder-date{text-align:right;margin:8px 0 24px;font-size:13px}.reminder-sheet h2{margin-top:18px}.reminder-text{line-height:1.55}

/* V41.2 – kompakter A4-Mahnbogen; bewusst unter der bedruckbaren Seitenhöhe */
.reminder-sheet{min-height:0;height:270mm;padding:13mm 19mm 15mm;font-size:10.5pt;line-height:1.4;overflow:hidden}
.reminder-top{padding-bottom:4mm;font-size:9pt;border-bottom:1px solid #888}
.reminder-top img{width:26mm;height:26mm}
.reminder-address{margin-top:10mm;height:33mm;font-size:10pt;line-height:1.45}
.reminder-date{margin:0 0 5mm;font-size:10pt}
.reminder-sheet h2{font-size:14pt;margin:0 0 5mm;line-height:1.3}
.reminder-text{font-size:10.5pt;line-height:1.43;white-space:pre-line}
.reminder-foot{bottom:12mm;left:19mm;right:19mm;font-size:8pt;padding-top:3mm}
.reminder-fold:before{top:105mm}.reminder-fold:after{top:210mm}
@media print{
  @page{size:A4 portrait;margin:0}
  html,body{margin:0!important;padding:0!important;width:210mm!important;height:auto!important;overflow:visible!important;background:white!important}
  body>*:not(.reminder-overlay){display:none!important}
  .reminder-overlay{position:static!important;inset:auto!important;margin:0!important;padding:0!important;overflow:visible!important;background:white!important;width:210mm!important;height:270mm!important}
  .reminder-wrap{width:210mm!important;max-width:none!important;margin:0!important;padding:0!important;box-shadow:none!important}
  .reminder-toolbar{display:none!important}
  .reminder-sheet{width:210mm!important;height:270mm!important;min-height:0!important;max-height:270mm!important;margin:0!important;overflow:hidden!important;break-inside:avoid!important;break-after:avoid!important;page-break-after:avoid!important}
}

/* V41.4 – ein einzelner Druckbogen; kein zusätzlicher Seitenfluss in Safari */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html, body { width: auto !important; height: 0 !important; min-height: 0 !important;
    margin: 0 !important; padding: 0 !important; overflow: visible !important;
    background: #fff !important; }
  body > :not(.reminder-overlay) { display: none !important; }
  .reminder-overlay { position: fixed !important; inset: 0 auto auto 0 !important;
    z-index: auto !important; width: 185mm !important; height: 245mm !important;
    min-height: 0 !important; max-height: 245mm !important; margin: 0 !important;
    padding: 0 !important; border: 0 !important; background: #fff !important;
    overflow: hidden !important; }
  .reminder-wrap { width: 185mm !important; height: 245mm !important;
    max-width: none !important; margin: 0 !important; padding: 0 !important;
    overflow: hidden !important; }
  .reminder-toolbar { display: none !important; }
  .reminder-sheet { box-sizing: border-box !important; width: 185mm !important;
    height: 245mm !important; min-height: 0 !important; max-height: 245mm !important;
    margin: 0 !important; padding: 10mm 12mm 12mm !important;
    overflow: hidden !important; break-before: avoid !important;
    break-after: avoid !important; break-inside: avoid !important;
    page-break-before: avoid !important; page-break-after: avoid !important;
    page-break-inside: avoid !important; }
  .reminder-foot { left: 12mm !important; right: 12mm !important;
    bottom: 9mm !important; }
}

/* V41.5: Safari – Mahnbrief sichtbar drucken, unabhängig davon,
   ob die Vorschau innerhalb oder außerhalb von <main> erzeugt wird.
   Keine fixed-Positionierung und keine body-Höhe von 0. */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html, body { width: auto !important; height: auto !important;
    min-height: 0 !important; margin: 0 !important; padding: 0 !important;
    overflow: visible !important; background: white !important; }
  body * { visibility: hidden !important; }
  body > main { display: block !important; position: static !important;
    height: 0 !important; min-height: 0 !important; max-height: 0 !important;
    padding: 0 !important; margin: 0 !important; border: 0 !important;
    overflow: visible !important; }
  .reminder-overlay, .reminder-overlay * { visibility: visible !important; }
  .reminder-overlay { display: block !important; position: absolute !important;
    top: 0 !important; left: 0 !important; right: auto !important;
    bottom: auto !important; inset: auto !important;
    width: 190mm !important; height: auto !important;
    min-height: 0 !important; max-height: none !important;
    margin: 0 !important; padding: 0 !important;
    overflow: visible !important; background: white !important;
    box-shadow: none !important; border: 0 !important; }
  .reminder-wrap { display: block !important; width: 190mm !important;
    height: auto !important; max-width: none !important;
    padding: 0 !important; margin: 0 !important;
    overflow: visible !important; border: 0 !important; box-shadow: none !important; }
  .reminder-toolbar { display: none !important; }
  .reminder-sheet { display: block !important; position: relative !important;
    box-sizing: border-box !important; width: 190mm !important;
    height: 250mm !important; min-height: 0 !important; max-height: 250mm !important;
    margin: 0 !important; padding: 10mm 12mm 12mm !important;
    overflow: hidden !important; break-before: avoid !important;
    break-after: avoid !important; break-inside: avoid !important; }
  .reminder-foot { left: 12mm !important; right: 12mm !important;
    bottom: 9mm !important; }
}

/* V42.1: DIN-5008-Bogen in der Vorschau; Druck erfolgt isoliert im neuen Fenster. */
@media screen {
.reminder-sheet{position:relative;width:210mm;height:296mm;min-height:0;margin:0 auto;padding:0;overflow:hidden;font:10.5pt Arial,Helvetica,sans-serif;line-height:normal}
.reminder-top{position:absolute;left:25mm;right:20mm;top:19mm;height:24mm;display:flex;justify-content:space-between;align-items:center;text-align:right;white-space:pre-line;font-size:9pt;line-height:1.4;border-bottom:1px solid #999;padding-bottom:2mm}
.reminder-top img{width:22mm;height:22mm;object-fit:contain}
.reminder-address{position:absolute;top:50mm;left:25mm;width:80mm;height:35mm;margin:0;overflow:hidden;white-space:pre-line;font-size:10.5pt;line-height:1.45}
.reminder-date{position:absolute;top:98mm;left:25mm;right:20mm;margin:0;text-align:right;font-size:9.5pt}
.reminder-sheet h2{position:absolute;top:112mm;left:25mm;right:20mm;margin:0;font-size:13pt;line-height:1.3}
.reminder-text{position:absolute;top:125mm;left:25mm;right:20mm;white-space:pre-line;font-size:10.5pt;line-height:1.45}
.reminder-foot{position:absolute;bottom:17mm;left:25mm;right:20mm;border-top:1px solid #aaa;padding-top:3mm;font-size:8pt}
.reminder-fold,.reminder-fold:before,.reminder-fold:after{position:absolute;left:0;width:5mm;height:0;border-top:.25mm solid #777}
.reminder-fold{top:148.5mm}.reminder-fold:before,.reminder-fold:after{content:'';left:0;top:0}.reminder-fold:before{transform:translateY(-43.5mm)}.reminder-fold:after{transform:translateY(61.5mm)}
}

.receipt-panel{padding:18px;margin:16px 0;border:1px solid #dab8c7;border-radius:12px;background:#fff9fc}.receipt-panel input{max-width:100%}.receipt-panel pre{font-size:12px}

/* V45.1: keep hidden views hidden and label receipt fields explicitly. */
[hidden]{display:none!important}
.receipt-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:14px;margin:12px 0;border:1px solid #e9c9d6;border-radius:10px;background:white}
.receipt-row label{min-width:0;font-size:.9em;font-weight:600}
.receipt-row .receipt-name,.receipt-row .receipt-choice{grid-column:1/-1}
.receipt-choice{display:flex;align-items:center;gap:8px}
.receipt-choice input[type=checkbox]{display:inline-block;width:auto;margin:0}
.receipt-panel select{display:block;width:100%;padding:12px;margin:10px 0;font:inherit;border:1px solid #d9b5c3;border-radius:9px;background:white}
#receiptCalculation{font-weight:600;line-height:1.6}
@media(max-width:550px){.receipt-row{grid-template-columns:1fr}}

.receipt-confirm{padding:16px;border:2px solid #a84f76;border-radius:10px;background:#fff1f7;margin:12px 0}.receipt-confirm h4{margin-top:0}.receipt-error{color:#a31535;font-weight:650}#receiptSaveMessage:empty{display:none}button:disabled{opacity:.5;cursor:default}

/* Wichtige Unterlagen: mobile form and private document cards. */
#documentsPanel{margin-top:16px;background:#fffafd}
#documentsPanel select{display:block;width:100%;font:inherit;padding:12px;margin:10px 0;border:1px solid #d9b5c3;border-radius:9px;background:white}
.document-summary{padding:12px;background:#f5dce6;border-radius:9px;line-height:1.6}
.document-editor{padding:14px;border:1px solid #e9c9d6;border-radius:10px;background:#fff}
.document-editor summary{font-weight:650;cursor:pointer}
.document-card{padding:18px;margin:14px 0;border:1px solid #e9c9d6;border-radius:12px;background:#fff;overflow-wrap:anywhere}
.document-card h3{margin:0 0 8px}.document-meta{font-size:.9em;color:#74535e;line-height:1.5}
.document-notes{white-space:pre-wrap}.document-status{padding:6px 10px;border-radius:8px;display:inline-block;margin:4px 0}
.document-status.due{color:#7e1830;background:#ffe1e8}.document-status.soon{color:#684500;background:#fff0c8}.document-status.quiet{color:#5d5260;background:#f2eef1}
.document-download{display:inline-block;padding:10px;border-radius:8px;background:#f4e5ec;color:#742c4d}
.document-check{display:flex;gap:10px;align-items:center}.document-check input{width:auto;display:inline-block}
#documentsMessage{white-space:pre-wrap;font-weight:600;line-height:1.6}
#documentsPanel .formGrid>*{min-width:0}
@media(max-width:550px){main{padding:12px}#documentsPanel{padding:12px}#documentsPanel .formGrid{grid-template-columns:1fr}.document-card .actions{flex-direction:column}}
/* V48: three-column customer cockpit, stacked on narrow screens. */
body.crm-view main{max-width:1560px}#customerCRM[hidden]{display:none}#customerCRM{padding:0;border:0;background:transparent}#customerCRM *{min-width:0}#customerCRM .crm-top{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:24px 0 12px}.crm-top h2{margin:5px 0}.crm-eyebrow{font-size:11px;font-weight:750;letter-spacing:.14em;color:#8d4965}.crm-grid{display:grid;grid-template-columns:230px minmax(360px,1fr) 280px;gap:18px;align-items:start}.crm-box{background:white;border:1px solid #e8d8df;border-radius:12px;padding:15px;margin-bottom:16px;overflow-wrap:anywhere}.crm-box h3{font-size:14px;margin:-15px -15px 14px;padding:12px 15px;background:#624053;color:white;border-radius:11px 11px 0 0}.crm-box p{line-height:1.5}.crm-muted,.crm-box small{font-size:12px;color:#806573}.crm-box button{font-size:12px;margin:3px 0;padding:10px 12px}.crm-box label{display:block;font-size:12px;font-weight:650;margin-bottom:10px}.crm-box input,.crm-box textarea,.crm-box select{font:inherit;width:100%;padding:9px;border:1px solid #d9c4ce;border-radius:7px;margin:5px 0}.crm-box select{background:white}.crm-filter,.crm-customer{display:block;width:100%;text-align:left;background:#faf4f7;color:#543244;border:1px solid #eddee5!important}.crm-filter.active,.crm-customer.active{background:#eed6e1;border-color:#a84f76!important}.crm-customer strong,.crm-customer small{display:block}.crm-customer small{margin-top:5px}.crm-box dl{margin:0}.crm-box dt{font-size:11px;color:#806573;margin-top:12px}.crm-box dd{font-size:13px;margin:3px 0}.crm-box .crm-due{background:#fff0da;color:#865007;padding:10px;border-radius:8px}.crm-linked,.crm-event{padding:10px 0;border-bottom:1px solid #efe5ea}.crm-linked span{display:block;font-size:12px;margin-top:4px}.crm-linked strong{font-size:13px}.crm-event p{white-space:pre-wrap;font-size:13px;margin:5px 0}.crm-message{font-size:13px;color:#814265}.crm-message:empty{display:none}#customerCRM #customerEntry{border:0;margin:0;padding:0}#customerCRM #customerEntry h3{background:none;color:#654454;margin:0;padding:0;font-size:12px}#customerCRM #customerEntry .formGrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 12px}#customerCRM #customerEntry label{font-size:12px}#customerCRM #customerNotes{min-height:70px}#customerCRM #customerError{color:#a22}#customerCRM .crm-grid aside:first-child .crm-box:last-child{max-height:70vh;overflow:auto}#customerCRM .crm-top button{flex-shrink:0}
@media(max-width:1150px){.crm-grid{grid-template-columns:210px minmax(0,1fr)}.crm-grid>aside:last-child{grid-column:2;grid-row:1}.crm-grid>.crm-center{grid-column:2}.crm-grid>aside:first-child{grid-row:1 / span 2}}
@media(max-width:720px){body.crm-view main{padding:12px}.crm-grid{display:flex;flex-direction:column}.crm-grid>aside,.crm-grid>.crm-center{width:100%}.crm-grid>aside:last-child{order:1}.crm-grid>.crm-center{order:2}.crm-grid>aside:first-child .crm-box:last-child{max-height:240px}#customerCRM #customerEntry .formGrid{grid-template-columns:1fr}.crm-top h2{font-size:22px}}
/* V48.1: conversation notes and priorities. */
.crm-note{padding:14px 0;border-bottom:1px solid #eadfe5}.crm-note:last-child{border-bottom:0}.crm-note-text{white-space:pre-wrap;overflow-wrap:anywhere;margin:8px 0;font-size:14px}.crm-note-tags{display:flex;flex-wrap:wrap;gap:5px;margin-bottom:5px}.crm-note-badge{display:inline-block;font-size:10px;font-weight:750;border-radius:5px;background:#f0e1e8;color:#704256;padding:4px 7px}.crm-note-actions{display:flex;flex-wrap:wrap;gap:5px;margin-top:9px}.crm-note-actions button{background:#f7eff3;color:#694355;border:1px solid #e2c9d5;padding:7px 10px}.crm-pinned-box{border:2px solid #a84f76}.crm-pinned-box h3{background:#a84f76;margin:-15px -15px 8px}.crm-note-done .crm-note-badge{background:#e7f0e8;color:#376140}.crm-note-tabs{display:flex;flex-wrap:wrap;gap:5px;margin-bottom:12px}.crm-note-tabs button{background:#f5edf1;color:#70475c;border:1px solid #e5ced9}.crm-note-tabs button.active{background:#a84f76;color:white;border-color:#a84f76}.crm-note small{line-height:1.5}
/* V48.2: customer documents and public product prices. */
.crm-material-group{padding:9px 0;border-bottom:1px solid #eee0e7}.crm-material-group:last-child{border-bottom:0}.crm-material-group strong{display:block;font-size:12px;margin-bottom:6px}.crm-material-group button{margin-right:5px;background:#f2e4eb;color:#70445a}.materials-overlay[hidden]{display:none}.materials-overlay{position:fixed;inset:0;background:#33232eaa;z-index:9000;overflow:auto;padding:25px}.materials-shell{max-width:850px;margin:0 auto;background:white;padding:24px;border-radius:15px;box-shadow:0 15px 60px #21172255}.materials-shell h2{font-size:23px}.materials-shell label{display:block;font-size:13px;font-weight:650;margin:12px 0}.materials-shell input:not([type=checkbox]),.materials-shell textarea,.materials-shell select{display:block;width:100%;font:inherit;padding:10px;border:1px solid #d8bdca;border-radius:7px;margin-top:7px}.materials-shell input[type=checkbox],.material-product-fields input[type=checkbox]{display:inline-block;width:auto;margin:0 8px 0 0;vertical-align:middle}.materials-shell label:has(input[type=checkbox]){display:flex;align-items:center;flex-direction:row-reverse;justify-content:flex-end;gap:8px;font-weight:500}.materials-shell textarea{min-height:135px}.material-hint{font-size:12px;color:#79596b;line-height:1.5}.material-preview:not(:empty){border:1px solid #dfc7d2;border-radius:10px;padding:18px;margin-top:20px}.material-mail-text{white-space:pre-wrap;overflow-wrap:anywhere;font:14px system-ui;background:#fcf6f8;padding:15px}.material-link{display:inline-block;background:#f2e3ea;color:#713c55;padding:10px 14px;border-radius:8px;margin:4px 8px 4px 0;text-decoration:none;font-weight:650;font-size:13px}.material-product-fields{border:1px solid #e4ccd7;padding:16px;border-radius:12px}.material-product-fields[hidden]{display:none}.material-product-fields label{font-size:13px;font-weight:650}.material-product-fields input[type=checkbox]{margin:10px}.materials-shell strong,.materials-shell small{display:block}.materials-shell small{font-size:12px;color:#79596b;margin:6px 0}.materials-shell p[role=status]{color:#8b365c;white-space:pre-line}
@media(max-width:650px){.materials-overlay{padding:10px}.materials-shell{padding:16px}.materials-shell h2{font-size:20px}}

.notification-settings{margin:16px 0;padding:14px;border:1px solid #dbc5d0;border-radius:12px;background:#fffafd}.notification-settings summary{font-weight:700;cursor:pointer}.notification-options{display:flex;flex-wrap:wrap;gap:16px;align-items:center;margin:12px 0}.notification-options label{display:flex;align-items:center;gap:8px}.notification-options input[type=checkbox]{width:auto;margin:0}.notification-options input[type=range]{width:130px}.notification-hint{font-size:.9em;color:#665560}#notificationStatus{min-height:1.4em}

.auto-refresh-status{font-size:.9em;color:#665560;margin:10px 0}
.finance-toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap}.finance-toolbar input{max-width:190px}.finance-summary{padding:16px;background:#f6e6ed;border-radius:10px;font-weight:600;line-height:1.7}.finance-editor{border:1px solid #dbc5d0;padding:14px;border-radius:10px;margin:14px 0}.finance-editor summary{cursor:pointer;font-weight:700;margin-bottom:12px}.finance-check{display:flex;align-items:center;gap:8px}.finance-check input{width:auto!important}.finance-table-wrap{overflow:auto;margin:14px 0}.finance-table{width:100%;border-collapse:collapse;font-size:.9em}.finance-table th,.finance-table td{padding:10px;vertical-align:top;text-align:left;border-bottom:1px solid #ddced6}.finance-table th{background:#6d3455;color:white}.finance-actions{display:flex;gap:4px;flex-wrap:wrap}.finance-actions button{font-size:.9em}#financePanel pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#fff6fa;padding:12px;font-size:.85em}#financeMessage{min-height:1.5em}

/* Consistent, accessible error messages. */
.nd-error-message { color:#b00020 !important; font-weight:700; white-space:pre-line; scroll-margin-block:32px; }
.nd-invalid-field { outline:2px solid #b00020; outline-offset:2px; }

.office-start{border:1px solid #d4b1c2;border-radius:12px;padding:16px;margin:12px 0;background:#fff8fb}.office-start h2{margin-top:0}.office-start button{margin:4px}.local-note{padding:12px;background:#f6edf2;border-radius:8px;margin-bottom:14px}

@media(max-width:700px){main{padding:10px}nav{display:flex;flex-wrap:wrap;gap:7px}nav button,nav a{max-width:100%;overflow-wrap:anywhere}.formGrid{grid-template-columns:1fr!important}input,select,textarea{max-width:100%;box-sizing:border-box}button{min-height:40px}.item{overflow-wrap:anywhere}header h1{font-size:1.6rem}}
