@charset "UTF-8";
/* ==========================================================================
   Visual Editor – A4 PDF Preview & Editing Styles
   Permanent Sidebar + A4 Preview Layout
   ========================================================================== */

/* === Editor Layout === */
.visual-editor { background: #e9ecef; min-height: 100vh; }

/* === Toolbar (slim top bar) === */
.ve-toolbar { background:white; border-bottom:1px solid #dee2e6; padding:8px 20px; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; position:sticky; top:0; z-index:200; box-shadow:0 2px 8px rgba(0,0,0,0.06); }
.ve-toolbar-left { display:flex; align-items:center; gap:12px; }
.ve-toolbar-right { display:flex; align-items:center; gap:8px; }
.ve-toolbar .btn { border-radius:8px; font-weight:500; font-size:0.875rem; }
.ve-save-indicator { font-size:0.8rem; color:#6c757d; }
.ve-save-indicator.saving { color:#0d6efd; }
.ve-save-indicator.saved { color:#198754; }
.ve-save-indicator.error { color:#dc3545; }

/* === Beleg-Aktionen in der Toolbar (js/document_actions.js) ===
   --ve-toolbar-h wird von VE.initDocActions() auf die echte Toolbar-Höhe gesetzt
   (bricht die Leiste auf schmalen Bildschirmen um, rutscht die Sidebar mit). */
.ve-toolbar-actions { flex:1 1 auto; min-width:0; display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:4px; }
.ve-toolbar-actions:empty { display:none; }
.ve-toolbar-actions .doc-action-bar { display:contents; }
.ve-toolbar-actions .dropdown-menu { z-index:1050; min-width:220px; box-shadow:0 8px 24px rgba(0,0,0,0.12); border:1px solid #e2e8f0; }
.ve-toolbar-actions .doc-btn .tooltip-text { bottom:auto; top:130%; }
.ve-toolbar-actions .offer-quick-btn { width:30px; height:30px; font-size:0.9rem; }
.ve-toolbar-actions .ve-status-badge { font-size:0.72rem; font-weight:500; padding:5px 8px; margin-right:4px; }
.ve-doc-nav { display:flex; align-items:center; gap:4px; }
.ve-doc-nav .ve-doc-nav-btn { padding:4px 7px; }
.ve-doc-nav .ve-doc-nav-btn.disabled { opacity:0.35; }

/* === Two-Column Layout: Paper + Sidebar === */
.ve-main-layout { display:flex; gap:0; min-height:calc(100vh - var(--ve-toolbar-h, 52px)); }
.ve-paper-column { flex:1; overflow-y:auto; padding:30px 20px 60px; display:flex; justify-content:center; align-items:flex-start; }
.ve-sidebar { width:320px; min-width:320px; background:white; border-left:1px solid #dee2e6; display:flex; flex-direction:column; position:sticky; top:var(--ve-toolbar-h, 52px); height:calc(100vh - var(--ve-toolbar-h, 52px)); overflow-y:auto; box-shadow:-2px 0 12px rgba(0,0,0,0.04); z-index:100; transition:width 0.25s ease, min-width 0.25s ease; }
/* Eingeklappt: Sidebar verschwindet, kleiner Pfeil-Tab am Rand für Wieder-Aufklappen */
.ve-sidebar.collapsed { width:0; min-width:0; overflow:hidden; border-left:none; box-shadow:none; }
.ve-sidebar-reopen { position:fixed; right:0; top:calc(var(--ve-toolbar-h, 52px) + 8px); z-index:101; background:#fff; border:1px solid #dee2e6; border-right:none; border-radius:6px 0 0 6px; padding:6px 8px; cursor:pointer; box-shadow:-2px 2px 8px rgba(0,0,0,0.08); display:none; }
.ve-sidebar-reopen:hover { background:#f8f9fa; color:#0d6efd; }
body.ve-sidebar-is-collapsed .ve-sidebar-reopen { display:block; }

.ve-sidebar-header { padding:14px 16px; border-bottom:1px solid #dee2e6; display:flex; justify-content:space-between; align-items:center; background:#f8f9fa; }
.ve-sidebar-header h6 { margin:0; font-size:0.9rem; font-weight:600; }
.ve-sidebar-header .btn-icon { background:transparent; border:none; padding:2px 6px; cursor:pointer; color:#6c757d; border-radius:4px; }
.ve-sidebar-header .btn-icon:hover { background:#e9ecef; color:#0d6efd; }
.ve-sidebar-body { flex:1; overflow-y:auto; padding:14px 16px; }
.ve-sidebar-footer { padding:12px 16px; border-top:1px solid #dee2e6; background:#f8f9fa; display:flex; flex-direction:column; gap:8px; }
.ve-sidebar-footer .btn { width:100%; border-radius:8px; font-weight:500; font-size:0.85rem; }

/* btn-group in der Sidebar — verhindert Overflow bei drei Buttons mit Icons */
.ve-sidebar .btn-group .btn { flex:1 1 0; min-width:0; padding:0.3rem 0.4rem; font-size:0.78rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ve-sidebar .btn-group .btn i { font-size:0.85rem; margin-right:2px; }

/* === Sidebar Sections === */
.ve-sidebar-section { margin-bottom:16px; padding-bottom:14px; border-bottom:1px solid #f0f0f0; }
.ve-sidebar-section:last-child { border-bottom:none; margin-bottom:0; }
.ve-sidebar-label { font-weight:600; font-size:0.8rem; margin-bottom:6px; display:block; color:#333; text-transform:uppercase; letter-spacing:0.3px; }
.ve-sidebar-sublabel { font-weight:600; font-size:0.78rem; margin-bottom:4px; display:block; color:#555; }
.ve-sidebar-hint { font-size:0.75rem; color:#6c757d; margin-top:4px; }

/* === Sidebar Custom Fields === */
.ve-custom-field-row { display:flex; gap:6px; }
.ve-custom-field-row input { flex:1; }

/* === ZK Dropdown with override indicator === */
.ve-zk-override-hint { font-size:0.72rem; color:#0d6efd; font-style:italic; margin-top:3px; display:none; }
.ve-zk-override-hint.visible { display:block; }

/* === A4 Paper === */
.ve-a4-page { width:210mm; min-height:297mm; max-width:100%; background:white; box-shadow:0 4px 20px rgba(0,0,0,0.12); border-radius:2px; position:relative; padding:20mm; margin:0 auto; font-family:Helvetica,Arial,sans-serif; font-size:10pt; line-height:1.4; color:#222; }

/* === Header === */
.ve-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:5mm; min-height:25mm; }
.ve-address-line { font-size:8pt; color:#555; margin-bottom:3mm; }
.ve-logo-area { max-width:50mm; text-align:right; }
.ve-logo-area img { max-width:50mm; max-height:20mm; object-fit:contain; }
.ve-title { font-size:16pt; font-weight:700; margin-bottom:8mm; color:#000; }

/* === Address & Info === */
.ve-address-info-row { display:flex; justify-content:space-between; margin-bottom:8mm; gap:10mm; }
.ve-customer-address { flex:1; font-size:10pt; line-height:1.6; }
.ve-offer-info { text-align:right; font-size:10pt; line-height:1.6; white-space:nowrap; }
.ve-custom-field-line { font-size:10pt; }

/* === Salutation & Rich Text === */
.ve-salutation { margin-bottom:3mm; font-size:10pt; }
.ve-richtext-zone { margin:4mm 0; min-height:10mm; position:relative; }
.ve-richtext-zone .ql-container { font-family:Helvetica,Arial,sans-serif; font-size:10pt; border:none !important; }
.ve-richtext-zone .ql-editor { padding:4px 0; min-height:20px; }
.ve-richtext-zone .ql-toolbar { display:none; position:absolute; top:-42px; left:0; z-index:100; background:white; border:1px solid #dee2e6 !important; border-radius:8px; box-shadow:0 4px 12px rgba(0,0,0,0.15); padding:4px 8px !important; }
.ve-richtext-zone:focus-within .ql-toolbar, .ve-richtext-zone.active .ql-toolbar { display:flex; }
.ve-richtext-zone .ql-editor.ql-blank::before { font-style:italic; color:#adb5bd; }

/* === Positions Table === */
.ve-positions-table { width:100%; border-collapse:collapse; margin:5mm 0; font-size:9pt; }
.ve-positions-table thead { background:#dcdcdc; }
.ve-positions-table thead th { padding:2mm 1.5mm; font-weight:700; font-size:9pt; white-space:nowrap; border:none; }
.ve-positions-table th.col-pos { width:6%; }
.ve-positions-table th.col-artnum { width:14%; }
.ve-positions-table th.col-desc { width:45%; }
.ve-positions-table th.col-qty { width:11%; text-align:right; }
.ve-positions-table th.col-price { width:12%; text-align:right; }
.ve-positions-table th.col-total { width:12%; text-align:right; }
.ve-positions-table tbody tr { border-bottom:1px solid #eee; transition:background 0.15s; }
.ve-positions-table tbody tr:hover { background:#f8f9ff; }
.ve-positions-table tbody td { padding:2mm 1.5mm; vertical-align:top; }
.ve-positions-table td.text-right { text-align:right; }

/* === Item Description === */
.ve-item-description { font-size:9pt; line-height:1.5; }
.ve-item-description strong { font-weight:700; }
.ve-alt-hint { color:#17a2b8; font-size:8.5pt; }
.ve-item-note-text { margin-top:2mm; font-size:8.5pt; color:#555; font-style:italic; }
.ve-item-note { margin-top:2mm; padding:2mm 3mm; background:#fafafa; border-left:2px solid #0d6efd; border-radius:0 4px 4px 0; font-size:8.5pt; color:#444; }
.ve-item-note .ql-editor { padding:2px 0; min-height:16px; font-size:8.5pt; }
.ve-item-note .ql-container { border:none !important; font-size:8.5pt; }

/* === Unit Label & Special Units === */
.ve-unit-label { font-size:8.5pt; color:#555; margin-left:2px; }
.ve-special-unit-hint { font-size:7pt; font-style:italic; color:#888; margin-top:1px; }

/* === Alternative Rows === */
.ve-alternative-row { border-left:3px solid #17a2b8 !important; background:rgba(23,162,184,0.03); font-style:italic; }
.ve-alternative-row .ve-pos-no::after { content:' \u2605'; color:#17a2b8; font-size:7pt; }

/* === PPWR-Materialsymbole (Position) === */
/* Kleine Thumbnails direkt unter der Positionsnummer — exakt die Stelle,
   an der generate_quote_pdf.php sie druckt. Der Button erscheint erst beim
   Hovern ueber der Zeile, damit die Vorschau nicht mit Bedienelementen
   zugestellt wird. */
.ve-pos-no { font-size:9pt; }
/* Die Symbole stehen unter der Artikelnummer (14% breit), nicht mehr unter
   der Positionsnummer — dort waere keine Breite ohne Umbau der Tabelle
   zu holen gewesen. Breite identisch zu $ppwrIconW in
   generate_quote_pdf.php; beide Werte gehoeren zusammen. */
.ve-ppwr-cell { margin-top:1.5mm; }
.ve-ppwr-thumbs { display:flex; flex-direction:column; gap:1mm; }
.ve-ppwr-thumb-wrap { position:relative; display:block; width:13mm; }
.ve-ppwr-thumb { width:13mm; height:auto; display:block; }
/* Loesch-X: erscheint erst beim Ueberfahren des Symbols, damit die
   Vorschau nicht dauerhaft mit Bedienelementen zugestellt ist. */
.ve-ppwr-del {
    position:absolute; top:-5px; right:-6px; width:18px; height:18px;
    padding:0; line-height:16px; font-size:14px; font-weight:700;
    color:#fff; background:#dc3545; border:1px solid #fff; border-radius:50%;
    opacity:0; transition:opacity 0.12s; cursor:pointer;
}
.ve-ppwr-thumb-wrap:hover .ve-ppwr-del { opacity:1; }
.ve-ppwr-del:hover { background:#b02a37; }
.ve-ppwr-btn {
    margin-top:1mm; padding:0 4px; line-height:16px; font-size:10px;
    color:#0d6efd; background:#fff; border:1px dashed #b6c7e4; border-radius:3px;
    opacity:0; transition:opacity 0.15s;
}
.ve-position-row:hover .ve-ppwr-btn { opacity:1; }
.ve-ppwr-btn:hover { background:#eef4ff; border-style:solid; }
/* Sind bereits Symbole gesetzt, bleibt der Button dezent sichtbar, damit
   klar ist, dass die Zuordnung aenderbar ist. */
.ve-ppwr-thumbs:not(:empty) + .ve-ppwr-btn { opacity:0.45; }

/* === PPWR-Auswahl-Dialog === */
.ve-ppwr-group {
    font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.04em;
    color:#6c757d; margin:14px 0 6px; padding-bottom:3px; border-bottom:1px solid #eee;
}
.ve-ppwr-group:first-child { margin-top:0; }
.ve-ppwr-row { display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:8px; }
.ve-ppwr-card {
    display:flex; gap:10px; align-items:flex-start; padding:8px 10px; cursor:pointer;
    border:1px solid #e3e6ea; border-radius:6px; background:#fff; transition:all 0.12s;
}
.ve-ppwr-card:hover { border-color:#b6c7e4; background:#f8faff; }
.ve-ppwr-card.selected { border-color:#0d6efd; background:#eef4ff; box-shadow:inset 0 0 0 1px #0d6efd; }
.ve-ppwr-card img { width:42px; height:auto; flex:0 0 42px; }
.ve-ppwr-card-body { min-width:0; }
.ve-ppwr-code { font-weight:700; font-size:13px; }
.ve-ppwr-name { font-size:12px; color:#333; }
.ve-ppwr-desc { font-size:11px; color:#666; line-height:1.4; margin-top:3px; }
.ve-ppwr-badges { display:flex; flex-wrap:wrap; gap:4px; margin-top:5px; }
.ve-ppwr-badge {
    font-size:10px; padding:1px 6px; border-radius:10px;
    background:#f1f3f5; color:#495057; border:1px solid #e3e6ea;
}
.ve-ppwr-badge.rec-good { background:#e6f5ec; color:#15703c; border-color:#c3e6d1; }
.ve-ppwr-badge.rec-mid  { background:#fff6e5; color:#8a5a00; border-color:#f3e0b8; }
.ve-ppwr-badge.rec-bad  { background:#fdecec; color:#96231f; border-color:#f3c9c7; }

/* === Excluded from Discount === */
.ve-excluded-row { opacity:0.85; }
.ve-excluded-row .ve-row-total { text-decoration:line-through; text-decoration-color:rgba(220,53,69,0.4); }

/* === Position Row Actions === */
.ve-item-actions { position:absolute; right:-40px; top:50%; transform:translateY(-50%); display:flex; flex-direction:column; gap:3px; opacity:0; transition:opacity 0.2s; }
.ve-position-row { position:relative; }
.ve-position-row:hover .ve-item-actions { opacity:1; }
.ve-item-actions button { width:26px; height:26px; border-radius:6px; border:1px solid #dee2e6; background:white; display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:11px; color:#6c757d; padding:0; transition:all 0.15s; }
.ve-item-actions button:hover { background:#0d6efd; border-color:#0d6efd; color:white; }
.ve-item-actions button.btn-delete:hover { background:#dc3545; border-color:#dc3545; }

/* === Add Position === */
.ve-add-position { border:2px dashed #dee2e6; border-radius:8px; padding:3mm; text-align:center; cursor:pointer; color:#6c757d; font-size:9pt; transition:all 0.2s; margin-top:3mm; }
.ve-add-position:hover { border-color:#0d6efd; color:#0d6efd; background:#f0f7ff; }

/* Add-Aktionen Container — 3 Buttons nebeneinander */
.ve-add-actions { display:flex; gap:2mm; margin-top:3mm; }
.ve-add-actions > .ve-add-position { flex:1; margin-top:0; }
.ve-add-actions > .ve-add-catalog:hover { border-color:#198754; color:#198754; background:#f0fdf4; }
.ve-add-actions > .ve-add-from-offer:hover { border-color:#fd7e14; color:#fd7e14; background:#fff7ed; }

/* Position-Picker Modal */
.ve-picker-item { display:flex; align-items:center; padding:8px 12px; border-bottom:1px solid #f1f3f5; cursor:pointer; transition:background 0.15s; gap:10px; }
.ve-picker-item:hover { background:#f8f9fa; }
.ve-picker-item.selected { background:#e7f1ff; }
.ve-picker-item-img { width:36px; height:36px; border-radius:4px; background:#f1f3f5; display:flex; align-items:center; justify-content:center; flex-shrink:0; overflow:hidden; }
.ve-picker-item-img img { max-width:100%; max-height:100%; object-fit:contain; }
.ve-picker-item-info { flex:1; min-width:0; }
.ve-picker-item-name { font-weight:500; font-size:0.875rem; }
.ve-picker-item-meta { color:#6c757d; font-size:0.75rem; }
.ve-picker-item-price { font-weight:600; color:#0d6efd; text-align:right; white-space:nowrap; min-width:90px; }
.ve-picker-item-qty { width:60px; }
.ve-picker-item-badge { background:#fff3cd; color:#856404; font-size:0.65rem; padding:2px 6px; border-radius:3px; }

.ve-picker-offer-card { border:1px solid #dee2e6; border-radius:6px; padding:10px 14px; margin-bottom:8px; cursor:pointer; }
.ve-picker-offer-card:hover { background:#f8f9fa; }
.ve-picker-offer-card.expanded { background:#fff; border-color:#0d6efd; }
.ve-picker-offer-positions { margin-top:8px; padding-top:8px; border-top:1px dashed #dee2e6; }

/* Produkt-Karten im Picker */
.ve-picker-card { background:#fff; border:1px solid #e5e7eb; border-radius:8px; padding:8px; cursor:pointer; transition:all 0.15s; text-align:center; display:flex; flex-direction:column; }
.ve-picker-card:hover { border-color:#0d6efd; box-shadow:0 4px 10px rgba(13,110,253,0.1); transform:translateY(-1px); }
.ve-picker-card.has-selection { border-color:#198754; background:#f0fdf4; }
.ve-picker-card-img { width:100%; height:90px; background:#f1f5f9; border-radius:4px; display:flex; align-items:center; justify-content:center; margin-bottom:6px; overflow:hidden; }
.ve-picker-card-img img { max-width:100%; max-height:100%; object-fit:contain; }
.ve-picker-card-name { font-size:0.78rem; font-weight:600; line-height:1.2; min-height:2.4em; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.ve-picker-card-meta { font-size:0.7rem; color:#6c757d; margin-top:4px; display:flex; justify-content:space-between; align-items:center; }
.ve-picker-card-price { font-size:0.72rem; color:#0d6efd; font-weight:600; }
.ve-picker-card-badge { position:absolute; top:6px; right:6px; background:#198754; color:#fff; font-size:0.65rem; padding:1px 6px; border-radius:10px; }

/* Konfig-Panel */
.ve-config-variant { border:2px solid #e5e7eb; border-radius:6px; padding:10px 12px; margin-bottom:6px; cursor:pointer; transition:all 0.15s; }
.ve-config-variant:hover { border-color:#93c5fd; background:#f0f7ff; }
.ve-config-variant.selected { border-color:#0d6efd; background:#eff6ff; }
.ve-config-option { border:1px solid #e5e7eb; border-radius:6px; padding:8px 12px; margin-bottom:4px; }
.ve-config-option.selected { border-color:#198754; background:#f0fdf4; }

/* Sticky-Footer innerhalb des Konfig-Panels — Action-Buttons bleiben sichtbar
   auch wenn die Optionen-Liste lang ist und gescrollt wird */
.ve-config-action-bar {
    position: sticky;
    bottom: -16px;                  /* Negativ um tab-content padding-bottom zu kompensieren */
    margin: 16px -16px -16px -16px; /* Volle Breite über tab-content padding */
    background: #fff;
    padding: 10px 16px;
    border-top: 2px solid #198754;
    box-shadow: 0 -4px 8px rgba(0,0,0,0.04);
    z-index: 5;
}

/* Auswahl-Korb sticky am unteren Modal-Rand (vor Footer) */
.ve-picker-sticky-cart { flex-shrink:0; background:#fff; }
/* Modal-Body als Flex-Container damit der Tab-Inhalt scrollt aber der Korb sichtbar bleibt */
#vePositionPickerModal .modal-body { display:flex; flex-direction:column; padding:0; max-height:75vh; }
#vePositionPickerModal .modal-body > .nav-tabs { flex-shrink:0; }
#vePositionPickerModal .modal-body > .tab-content { flex:1; overflow-y:auto; padding:16px; }

/* Auswahl-Korb */
.ve-picker-cart-item { display:flex; justify-content:space-between; align-items:center; padding:6px 10px; border:1px solid #e5e7eb; border-radius:5px; margin-bottom:4px; background:#fff; font-size:0.85rem; }
.ve-picker-cart-item-remove { color:#dc3545; cursor:pointer; padding:2px 6px; }
.ve-picker-cart-item-remove:hover { background:#fee; border-radius:3px; }

/* === Summary === */
.ve-summary { margin-top:5mm; border-top:1px solid #ccc; padding-top:3mm; }
.ve-summary-row { display:flex; justify-content:flex-end; align-items:center; padding:1mm 0; font-size:10pt; gap:5mm; }
.ve-summary-label { text-align:right; min-width:50mm; }
.ve-summary-value { text-align:right; min-width:35mm; font-variant-numeric:tabular-nums; }
.ve-summary-row.total { font-weight:700; font-size:10pt; border-top:1px solid #222; padding-top:2mm; margin-top:1mm; }
.ve-summary-row.discount { font-size:9pt; }
.ve-summary-row.discount .ve-editable { padding:1px 4px; border:1px dashed transparent; border-radius:3px; min-width:22px; display:inline-block; }
.ve-summary-row.discount:hover .ve-editable { border-color:#cbd5e1; background:#f8fafc; }
.ve-summary-row.discount .ve-editable:focus { border-color:#0d6efd; background:#fff; outline:none; }
/* Bei 0%: ganze Zeile gedimmt, "Klick zum Eingeben"-Hint sichtbar */
.ve-summary-row.discount.ve-discount-empty { color:#9ca3af; font-style:italic; }
.ve-summary-row.discount.ve-discount-empty .ve-summary-value { visibility:hidden; }
.ve-summary-row.discount.ve-discount-empty::after { content:" Klick zum Eingeben"; font-size:8pt; color:#94a3b8; margin-left:8px; }
/* Drucken: 0%-Rabatt-Zeile NICHT mitdrucken (sinnlos im PDF) */
@media print { .ve-summary-row.discount.ve-discount-empty { display:none !important; } }
.ve-summary-row.tax { font-size:9pt; }
.ve-summary-row.font-bold { font-weight:700; }

/* === EU Compliance === */
.ve-eu-compliance { font-size:9pt; color:#333; line-height:1.5; }
.ve-eu-compliance p { margin:0 0 2mm; }

/* === Custom Blocks === */
.ve-custom-blocks { margin:5mm 0; }
.ve-custom-block { position:relative; margin:3mm 0; padding:3mm 0; }
.ve-block-remove { position:absolute; right:-30px; top:2px; width:26px; height:26px; border-radius:6px; border:1px solid #dee2e6; background:white; display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:11px; color:#6c757d; opacity:0; transition:opacity 0.2s; }
.ve-custom-block:hover .ve-block-remove { opacity:1; }
.ve-add-block { border:2px dashed #dee2e6; border-radius:8px; padding:2mm; text-align:center; cursor:pointer; color:#6c757d; font-size:8.5pt; transition:all 0.2s; margin:3mm 0; }
.ve-add-block:hover { border-color:#198754; color:#198754; background:#f0fdf4; }

/* === Terms === */
.ve-terms { margin-top:5mm; font-size:10pt; line-height:1.6; }
.ve-terms-line { margin-bottom:2mm; }
.ve-terms-label { font-weight:400; }

/* === Closing === */
.ve-closing { margin-top:5mm; font-size:10pt; }
.ve-signature-area { margin:3mm 0; }
.ve-signature-area img { max-width:40mm; max-height:15mm; }

/* === Footer === */
.ve-footer { margin-top:15mm; display:grid; grid-template-columns:repeat(4,1fr); gap:3mm; font-size:6.5pt; line-height:1.3; color:#555; border-top:1px solid #ddd; padding-top:3mm; white-space:normal; }
.ve-footer-col { white-space:normal; }
.ve-page-number { text-align:center; font-size:8pt; font-style:italic; color:#888; margin-top:3mm; }

/* === Editable Fields === */
.ve-editable { border:1px solid transparent; border-radius:3px; padding:1px 3px; margin:-1px -3px; transition:all 0.2s; cursor:text; display:inline-block; min-width:20px; }
.ve-editable:hover { border-color:#bee3f8; background:#f0f7ff; }
.ve-editable:focus { outline:none; border-color:#0d6efd; background:white; box-shadow:0 0 0 2px rgba(13,110,253,0.15); }
.ve-editable[data-placeholder]:empty::before { content:attr(data-placeholder); color:#adb5bd; font-style:italic; }
.ve-editable-number { text-align:right; font-variant-numeric:tabular-nums; }

/* === Item Settings Popover === */
.ve-item-popover { position:absolute; z-index:250; background:white; border:1px solid #dee2e6; border-radius:10px; box-shadow:0 8px 24px rgba(0,0,0,0.12); width:260px; }
.ve-item-popover-header { padding:10px 14px; border-bottom:1px solid #eee; display:flex; justify-content:space-between; align-items:center; font-weight:600; font-size:0.85rem; }
.ve-item-popover-body { padding:12px 14px; }
.ve-fmt-popup { position:absolute; z-index:300; display:flex; gap:2px; background:#212529; border-radius:6px; padding:3px; box-shadow:0 4px 14px rgba(0,0,0,0.25); }
.ve-fmt-popup button { width:28px; height:28px; border:none; background:transparent; color:#fff; border-radius:4px; cursor:pointer; font-size:13px; line-height:1; display:flex; align-items:center; justify-content:center; padding:0; }
.ve-fmt-popup button:hover { background:rgba(255,255,255,0.18); }

/* === Selection Screen === */
.ve-select-screen { max-width:800px; margin:40px auto; padding:0 20px; }
.ve-select-card { background:white; border-radius:12px; box-shadow:0 2px 12px rgba(0,0,0,0.08); overflow:hidden; }
.ve-select-header { background:linear-gradient(135deg,#0d1b3e 0%,#1a3a6e 50%,#0d6efd 100%); color:white; padding:30px; }
.ve-select-header h2 { margin:0 0 8px; font-size:1.5rem; }
.ve-select-header p { margin:0; opacity:0.8; font-size:0.9rem; }
.ve-select-body { padding:20px; }
.ve-offer-list { max-height:500px; overflow-y:auto; }
.ve-offer-item { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border:1px solid #eee; border-radius:8px; margin-bottom:8px; cursor:pointer; transition:all 0.15s; text-decoration:none; color:inherit; }
.ve-offer-item:hover { border-color:#0d6efd; background:#f0f7ff; transform:translateX(3px); }
.ve-offer-item-left { display:flex; flex-direction:column; gap:2px; }
.ve-offer-item-number { font-weight:600; color:#0d6efd; }
.ve-offer-item-company { font-size:0.9rem; }
.ve-offer-item-date { font-size:0.8rem; color:#6c757d; }
.ve-offer-item-right { text-align:right; }
.ve-offer-item-amount { font-weight:600; font-size:1.1rem; }

/* === History Panel (slide-out overlay) === */
.ve-history-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.3); z-index:290; opacity:0; pointer-events:none; transition:opacity 0.3s; }
.ve-history-overlay.open { opacity:1; pointer-events:auto; }
.ve-history-panel { position:fixed; right:-480px; top:0; bottom:0; width:480px; background:white; box-shadow:-4px 0 20px rgba(0,0,0,0.1); z-index:300; transition:right 0.3s ease; display:flex; flex-direction:column; }
.ve-history-panel.open { right:0; }
.ve-history-header { padding:16px 20px; border-bottom:1px solid #dee2e6; display:flex; justify-content:space-between; align-items:center; }
.ve-history-body { flex:1; overflow-y:auto; padding:16px 20px; }
.ve-history-item { padding:10px 12px; border:1px solid #eee; border-radius:8px; margin-bottom:8px; cursor:pointer; transition:all 0.15s; }
.ve-history-item:hover { border-color:#0d6efd; background:#f0f7ff; }
.ve-history-item-date { font-weight:600; font-size:0.85rem; }
.ve-history-item-user { font-size:0.8rem; color:#6c757d; }

/* === Responsive === */
@media (max-width:1100px) {
    .ve-sidebar { width:280px; min-width:280px; }
}
@media (max-width:900px) {
    .ve-main-layout { flex-direction:column-reverse; }
    .ve-sidebar { width:100%; min-width:100%; position:static; height:auto; max-height:50vh; border-left:none; border-top:1px solid #dee2e6; }
    .ve-paper-column { padding:15px 10px 40px; }
    .ve-a4-page { width:100%; min-height:auto; padding:15mm; font-size:9pt; }
    .ve-footer { grid-template-columns:repeat(2,1fr); margin-top:10mm; }
    .ve-item-actions { right:-28px; }
}

/* === Print === */
@media print {
    .ve-toolbar,.ve-sidebar,.ve-item-actions,.ve-add-position,.ve-add-block,.ve-add-actions,.ve-block-remove,.ve-section-hint,.ql-toolbar,.ve-history-panel,.ve-history-overlay,.ve-item-popover,.ve-fmt-popup,#vePositionPickerModal { display:none !important; }
    .ve-main-layout { display:block; }
    .ve-a4-page { box-shadow:none; margin:0; padding:20mm; }
    .ve-editable { border:none !important; background:none !important; box-shadow:none !important; }
    .ve-alternative-row { font-style:italic; }
}
/* === Inline Spacer (zwischen Sektionen, einstellbar) === */
/* Höhe wird inline per style="height: Xmm" gesetzt */
.ve-spacer {
    position: relative;
    transition: background 0.15s ease;
    cursor: ns-resize;
    margin: 0 -5mm;
    padding: 0 5mm;
    /* Mindesthoehe als Hover-/Klick-Ziel: bei 0 mm bliebe der Spacer sonst 0 px hoch
       und der +/--Griff waere nicht mehr erreichbar (nicht ruecksetzbar). Das PDF
       nutzt den gespeicherten mm-Wert, nicht diese CSS-Hoehe -> Ausgabe unveraendert. */
    min-height: 7px;
}
.ve-spacer:hover {
    background: rgba(13, 110, 253, 0.06);
}
.ve-spacer:hover::before {
    content: '';
    position: absolute;
    left: 5mm;
    right: 5mm;
    top: 50%;
    border-top: 1px dashed rgba(13, 110, 253, 0.4);
}
.ve-spacer-handle {
    position: absolute;
    right: 5mm;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    background: white;
    border: 1px solid #0d6efd;
    border-radius: 4px;
    padding: 2px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    align-items: center;
    gap: 4px;
    z-index: 10;
    font-family: -apple-system, sans-serif;
}
.ve-spacer:hover .ve-spacer-handle { display: flex; }
.ve-spacer-handle button {
    width: 22px;
    height: 22px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: 0;
    color: #0d6efd;
    line-height: 1;
}
.ve-spacer-handle button:hover { background: #e7f1ff; }
.ve-spacer-handle .ve-spacer-value {
    font-size: 11px;
    color: #495057;
    min-width: 38px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.ve-spacer-handle .ve-spacer-label {
    font-size: 10px;
    color: #6c757d;
    padding-right: 4px;
    border-right: 1px solid #e7eaf0;
    margin-right: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
/* @media print: Spacer-Handle nicht im PDF-Preview anzeigen */
@media print {
    .ve-spacer:hover { background: none; }
    .ve-spacer:hover::before { display: none; }
    .ve-spacer-handle { display: none !important; }
}

/* === WYSIWYG-Whitespace-Reset ===
 * Sektionen haben KEINE eigenen Margins/Paddings mehr. Die Abstände
 * werden ausschließlich über die einstellbaren Spacer kontrolliert,
 * damit das, was im Editor zu sehen ist, exakt im PDF rauskommt.
 * Quill-Editoren bekommen kompaktes Innen-Layout (matched p-Margins zum PDF).
 */
.ve-salutation { margin: 0 !important; padding: 0 !important; }
.ve-positions-table { margin: 0 !important; }
.ve-summary { margin-top: 0 !important; padding-top: 3mm; border-top: 1px solid #ccc; }
.ve-eu-compliance.ve-section { margin: 0 !important; padding: 0 !important; }
.ve-eu-compliance p { margin: 0 0 2pt 0 !important; }
.ve-custom-blocks { margin: 0 !important; }
.ve-custom-block { margin: 0 !important; padding: 0 !important; }
.ve-richtext-zone { margin: 0 !important; }
.ve-richtext-zone .ql-container { line-height: 1.4; }
.ve-richtext-zone .ql-editor { padding: 0 !important; }
.ve-richtext-zone .ql-editor p { margin: 0 0 2pt 0 !important; }
.ve-richtext-zone .ql-editor p:last-child { margin-bottom: 0 !important; }
.ve-terms { margin: 0 !important; padding: 0 !important; }
.ve-terms-line { margin-bottom: 0 !important; line-height: 1.4; }
.ve-closing { margin: 0 !important; padding: 0 !important; }
.ve-closing > div { margin: 0 !important; padding: 0 !important; }
/* "Textblock hinzufügen"-Button bleibt mit etwas Abstand zur Lesbarkeit,
 * weil er im PDF gar nicht erscheint (Editor-only-Action) */
.ve-add-block { margin: 2mm 0 0 0; }

/* === EK-Zeile pro Position (nur mit purchase_price-Permission sichtbar) === */
.ve-item-ek {
    margin-top: 2mm;
    padding: 1mm 2mm;
    background: #fafbfc;
    border-left: 2px solid #dee2e6;
    border-radius: 0 3px 3px 0;
    font-size: 7.5pt;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    line-height: 1.4;
}
.ve-item-ek:hover {
    background: #eef4ff;
    border-left-color: #0d6efd;
    color: #495057;
}
.ve-item-ek .ve-ek-icon { color: #6c757d; }
.ve-item-ek .ve-ek-label { font-weight: 500; }
.ve-item-ek .ve-ek-value { font-weight: 600; color: #212529; }
.ve-item-ek .ve-ek-sep { color: #adb5bd; }
.ve-item-ek .ve-ek-margin { font-weight: 600; }
.ve-item-ek .ve-ek-margin.pos { color: #15803d; }
.ve-item-ek .ve-ek-margin.neg { color: #dc2626; }
.ve-item-ek .ve-ek-supplier { color: #495057; font-style: italic; }
.ve-item-ek .ve-ek-empty {
    color: #adb5bd;
    font-style: italic;
}
.ve-item-ek:hover .ve-ek-empty { color: #0d6efd; }
/* @media print: EK-Zeile NICHT im PDF-Preview anzeigen */
@media print { .ve-item-ek { display: none !important; } }

/* === Customer-Picker-Button in der Kundenadresse === */
/* Gemeinsame Leiste fuer "Kontaktdaten scannen" + "Kunde waehlen": sitzt knapp
   ueber dem Adressblock, die Buttons stehen nebeneinander statt uebereinander. */
.ve-customer-picker-btns {
    position: absolute;
    top: -22px;
    right: 0;
    display: flex;
    gap: 4px;
    z-index: 5;
    white-space: nowrap;
}
.ve-customer-picker-btn {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.7rem;
    line-height: 1.4;
    color: #0d6efd;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s ease;
}
.ve-customer-address { position: relative; }
.ve-customer-address:hover .ve-customer-picker-btn {
    opacity: 1;
}
.ve-customer-picker-btn:hover {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
}
/* @media print: Picker-Button im PDF nicht zeigen */
@media print { .ve-customer-picker-btns, .ve-customer-picker-btn { display: none !important; } }

/* === Customer-Picker Modal-Items === */
#veCustomerList .ve-customer-item {
    cursor: pointer;
    padding: 10px 14px;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}
#veCustomerList .ve-customer-item:hover {
    background: #f0f7ff;
    border-left-color: #0d6efd;
}
#veCustomerList .ve-customer-item .ve-cust-company {
    font-weight: 600;
    color: #212529;
}
#veCustomerList .ve-customer-item .ve-cust-meta {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 2px;
}

/* === Customer-Picker: Ansprechpartner-Chips === */
.ve-cust-contacts {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px dashed #e7eaf0;
}
.ve-cust-contacts-empty {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #e7eaf0;
    font-size: 0.72rem;
    color: #adb5bd;
    font-style: italic;
}
.ve-contact-chip {
    display: inline-flex;
    align-items: center;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 0.75rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.ve-contact-chip:hover {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.25);
}
.ve-contact-chip:hover i { color: #fde047 !important; }

/* === Lieferschein-Vorschau: keine Preise/Summen/Marge (spiegelt generate_document.php
   show_pricing=false). Wrapper .ve-no-pricing wird in visual_editor.php gesetzt.
   DOM bleibt erhalten (JS-Recalc laeuft harmlos weiter), nur visuell ausgeblendet. === */
.ve-no-pricing .col-price,
.ve-no-pricing .col-total,
.ve-no-pricing .ve-cell-price,
.ve-no-pricing .ve-cell-total,
.ve-no-pricing .ve-summary,
.ve-no-pricing .ve-item-ek,
.ve-no-pricing .ve-eu-compliance { display: none !important; }

/* === Mietangebot-Block im Preview (spiegelt generate_quote_pdf.php rental). Read-only:
   Konditionen kommen aus der Sidebar (offer.rental), Rechtstexte aus document_settings. === */
.ve-rental-block { margin-top: 8mm; }
.ve-rental-title { font-weight: 700; font-size: 11pt; margin-bottom: 4mm; }
.ve-rental-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
.ve-rental-table th, .ve-rental-table td { border: 1px solid #999; padding: 4px 7px; }
.ve-rental-table thead th { background: #f0f0f0; }
.ve-rental-table .text-right { text-align: right; }
.ve-rental-insurance { border: 1px solid #e0a0a0; background: #fff5f5; padding: 6px 8px; margin-top: 4mm; font-size: 9pt; }
.ve-rental-insurance-title { font-weight: 700; margin-bottom: 2px; }
.ve-rental-terms { margin-top: 6mm; }
.ve-rental-terms-title { font-weight: 700; font-size: 12pt; margin-bottom: 3mm; }
.ve-rental-terms-body { font-size: 9pt; }
.ve-rental-hint { margin-top: 4mm; font-size: 8pt; color: #2563eb; }
