:root{
  --bg:#f3f4f6;
  --panel:#ffffff;
  --line:#d1d5db;
  --text:#111827;
  --muted:#6b7280;
  --accent:#6b7280;
  --accent-soft:#e5e7eb;
  --danger:#dc2626;
  --radius:12px;
  --shadow:0 4px 18px rgba(0,0,0,.08);
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  --topbar-x-padding:14px;
  --topbar-column-gap:14px;
  --sidebar-padding:14px;
  --left-header-width:290px;
  --left-header-width-compact:260px;
  --left-sidebar-width:calc(var(--left-header-width) + var(--topbar-x-padding) + var(--topbar-column-gap));
  --left-sidebar-width-compact:calc(var(--left-header-width-compact) + var(--topbar-x-padding) + var(--topbar-column-gap));
  --right-sidebar-width:380px;
  --right-sidebar-width-compact:340px;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;font-family:var(--font);background:var(--bg);color:var(--text)}
body{display:flex;flex-direction:column;overflow:hidden}
.topbar{min-height:0;display:grid;grid-template-columns:var(--left-header-width) minmax(0,1fr);grid-template-rows:auto auto;align-items:start;column-gap:var(--topbar-column-gap);row-gap:3px;padding:8px var(--topbar-x-padding) 4px;background:#fff;color:var(--text);border-bottom:1px solid var(--line);flex:0 0 auto}
.header-row{display:flex;align-items:center;gap:16px;min-width:0}
.header-brand-stack{grid-column:1;grid-row:1 / 3;align-self:stretch;display:flex;flex-direction:column;justify-content:flex-start;gap:8px;width:100%;min-width:0}
.header-main-row{grid-column:2;grid-row:1;justify-content:space-between}
.header-system-row{grid-column:2;grid-row:2}
.brand{display:flex;align-items:center;gap:28px;min-width:0}
.brand-logo{display:block;width:290px;height:auto;object-fit:contain;flex:0 0 auto}
.header-logo{width:100%;max-width:290px;align-self:center;margin-block:auto}
.product-nav{display:flex;flex-direction:column;gap:7px;min-width:0}
.company-switcher{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}
.category-switcher{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0;flex:1}
.system-switcher{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.system-switcher.system-switch-header{width:100%;align-items:flex-start}
/* Header-Navigation: Kategorie- und Produktbuttons teilen dieselbe Klasse, damit Reihe 2 und 3 exakt gleich hoch bleiben. */
.brand-button,.header-button,.company-button{border:1px solid #d1d5db;background:#fff;color:#111827;border-radius:8px;font-weight:700;cursor:pointer}
.header-button{height:30px;display:inline-flex;align-items:center;justify-content:center;padding:0 12px;font-size:12px;line-height:1.1}
/* Firmenfilter werden als Logo-Buttons gerendert; die Bildhoehe ist fix, die Breite bleibt ueber auto proportional. */
.company-button{height:30px;display:inline-flex;align-items:center;justify-content:center;padding:3px 10px}
.company-logo{display:block;height:22px;width:auto;max-width:120px;object-fit:contain}
.company-label{font-size:12px;line-height:1.1}
.system-button{--system-button-width:108px;--system-button-height:90px;--system-button-label-height:20px;--system-button-border:#d1d5db;width:var(--system-button-width);height:var(--system-button-height);min-height:0;max-height:none;display:inline-flex;flex:0 0 auto;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:0;padding:0;overflow:hidden;border-color:var(--system-button-border)}
.header-button.system-button{height:var(--system-button-height);min-height:0;max-height:none;padding:0}
.system-button-icon{flex:1 1 auto;min-width:0;min-height:0;display:flex;align-items:stretch;justify-content:stretch;background:#fff;overflow:hidden}
.system-button-icon img{display:block;width:100%;height:100%;min-width:100%;min-height:100%;object-fit:cover;object-position:center}
.system-button-divider{height:0;flex:0 0 0;background:var(--system-button-border)}
.system-button-label{display:flex;align-items:center;justify-content:center;min-height:0;flex:0 0 var(--system-button-label-height);margin:0;padding:1px 6px;font-size:11.5px;font-weight:600;line-height:1;text-align:center;white-space:normal}
.company-button.active,
.category-button.active,
.system-button.active{border-color:#9ca3af;background:#e5e7eb;color:#111827}
.system-button.active{--system-button-border:#9ca3af}
.tool-row{display:flex;align-items:center;justify-content:flex-start;gap:10px;min-width:0;flex-wrap:wrap}
.command-card{position:relative;min-height:68px;min-width:0;max-width:100%;flex:0 1 auto;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;flex-wrap:nowrap;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:transparent;box-shadow:none;overflow:visible}
.command-card .btn{min-height:28px;max-width:100%;padding:4px 8px;font-size:12px;line-height:1;border-radius:8px;white-space:normal;text-align:center}
.command-card .icon-btn{width:28px;display:inline-flex;align-items:center;justify-content:center;padding:0}
.command-card-title{font-size:10.5px;font-weight:400;line-height:1;color:#6b7280;white-space:nowrap}
.command-card-body{display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;width:100%;min-width:0}
.icon-btn svg{width:17px;height:17px;display:block;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.icon-btn.undo-icon{color:#64748b}
.icon-btn.redo-icon{color:#64748b}
.icon-btn.save-icon{color:#16a34a}
.icon-btn.save-as-icon{color:#64748b}
.icon-btn.load-icon{color:#f59e0b}
.icon-btn:hover{color:var(--accent)}
.header-options-button{width:38px;height:38px;display:inline-flex;align-items:center;justify-content:center;padding:0;flex:0 0 auto;color:#475569;border:0;background:transparent;box-shadow:none;outline:0;cursor:pointer}
.header-options-button svg{width:34px;height:34px;display:block;fill:none;stroke:currentColor;stroke-width:1.35;stroke-linecap:round;stroke-linejoin:round}
.header-options-button:hover,.header-options-button:focus,.header-options-button:active,.header-options-button.is-active{background:transparent;border:0;box-shadow:none;color:#475569;outline:0}
.command-card input[type="checkbox"]{width:13px;height:13px;margin:0}
.command-card label{font-size:12px}
.floorplan-status-controls{display:flex;align-items:center;gap:8px}
.floorplan-status-controls select{width:70px;height:28px;padding:0 7px;border-radius:8px;font-size:12px}
.floorplan-status-controls input{width:54px;height:28px;padding:4px 8px;border-radius:8px;font-size:12px}
.room-height-field{height:28px;display:flex;align-items:center;gap:6px;font-size:12px;white-space:nowrap;color:#374151}
.room-height-field input{width:72px;height:28px;padding:4px 7px;border-radius:8px;font-size:12px;text-align:right}
.grid-action-buttons{gap:12px}
.topbar h1{margin:0;font-size:24px}
.subtitle{font-size:13px;color:var(--muted)}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-start;align-items:flex-start;min-width:0;max-width:100%}
.toolbar .btn{max-width:100%;white-space:normal;text-align:center}
.toolbar-card{min-height:68px}
.btn{border:1px solid #94a3b8;background:#fff;color:#111827;padding:8px 12px;border-radius:8px;cursor:pointer;font-size:13px}
.btn:hover{border-color:#9ca3af;color:#111827;background:#f3f4f6}
.btn.primary{background:#e5e7eb;color:#111827;border-color:#9ca3af}
.product-toolbar .btn{min-height:28px;padding-inline:10px;font-size:13px;background:#fff;color:#111827;border-color:#cbd5e1}
.product-toolbar .btn:hover{background:#fff7ed;border-color:#fb923c;color:#9a3412}
.product-toolbar .btn.is-selected,
.product-toolbar .btn.is-selected:hover{background:#e5e7eb;border-color:#9ca3af;color:#111827}
.product-toolbar .btn.is-active,
.product-toolbar .btn.is-active:hover{background:#f97316;border-color:#f97316;color:#fff}
.command-card .btn.is-active,
.command-card .btn.is-active:hover{background:#f97316;border-color:#f97316;color:#fff}
.btn.danger{border-color:#fecaca;color:var(--danger)}
.file-btn{display:inline-flex;align-items:center}
/* Testlayout: Hauptbereiche ohne Kartenoptik enger zusammenfuehren. */
.app-shell{display:grid;grid-template-columns:var(--left-sidebar-width) minmax(0,1fr) var(--right-sidebar-width);grid-template-rows:minmax(0,1fr);gap:0;padding:0;flex:1 1 auto;min-height:0;overflow:hidden}
.sidebar{min-height:0;background:var(--panel);border:1px solid var(--line);border-radius:0;box-shadow:none;padding:var(--sidebar-padding);overflow:auto}
.sidebar.left{min-width:0}
.sidebar.left .card,.sidebar.left .stack,.sidebar.left button,.sidebar.left input,.sidebar.left select{min-width:0;max-width:100%}
.sidebar.left .card-title,.sidebar.left .stack button{overflow:hidden;text-overflow:ellipsis}
.sidebar.left .stack button{white-space:nowrap}
.company-switcher.company-switch-header{display:grid;grid-template-columns:1fr 1fr;gap:8px;width:100%;align-items:stretch;flex-wrap:nowrap}
.company-switch-header .company-button{width:100%;height:34px;min-width:0;padding:4px 8px}
.company-switch-header .company-logo{max-width:100%}
.workspace{display:flex;flex-direction:column;overflow:hidden;min-width:0;min-height:0}
.canvas-wrap{position:relative;flex:1 1 auto;min-width:0;min-height:220px;background:#fff;border:1px solid var(--line);border-radius:0;box-shadow:none;overflow:hidden}
#planSvg,#view3d{width:100%;height:100%;display:block}
#planSvg,#planSvg *{user-select:none;-webkit-user-select:none}
.canvas-statusbar{position:absolute;left:12px;right:12px;bottom:10px;z-index:5;min-height:28px;display:flex;align-items:center;padding:6px 10px;border:1px solid var(--line);border-radius:0;background:rgba(255,255,255,.94);color:var(--muted);font-size:12px;box-shadow:none;pointer-events:none}
.hidden{display:none}
.is-hidden{display:none}
.statusbar{display:flex;flex-direction:column;gap:0;row-gap:0;column-gap:0;flex:0 0 auto;min-width:0;min-height:0;height:auto;max-height:none;overflow:visible;padding:0;margin-bottom:0;background:#fff;border:1px solid var(--line);border-radius:0;color:var(--muted);font-size:12px;box-shadow:none}
.statusbar .command-card{min-height:56px;padding:4px 6px;gap:6px;margin:0;border-top:none;border-left:none;border-right:1px solid var(--line);border-bottom:1px solid var(--line);border-radius:0}
.statusbar .command-card-body{gap:6px}
.statusbar-actions{display:flex;align-items:flex-start;justify-content:flex-start;gap:0;row-gap:0;column-gap:0;min-width:0;max-width:100%;flex-wrap:wrap}
.statusbar-tools{width:100%;min-height:0;align-items:flex-start;margin-top:0;padding-top:0;border-top:0}
.statusbar .toolbar{justify-content:flex-start;gap:0;row-gap:0;column-gap:0}
.statusbar #systemToolbar .command-card{border-top:none;border-left:none;border-right:1px solid var(--line);border-bottom:none;border-radius:0}
.section-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin:2px 0 10px}
section{margin-bottom:18px}
.field{display:flex;flex-direction:column;gap:4px;margin-bottom:10px}
.field.inline{flex-direction:row;gap:14px}
.grid-controls{display:flex;align-items:end;gap:12px;flex-wrap:wrap}
.grid-size-field{display:flex;flex-direction:column;gap:4px;flex:0 0 auto}
.grid-size-field select{width:76px}
.grid-actions #selGridSize{width:64px;height:28px;padding:0 7px;border-radius:8px;line-height:28px}
.grid-actions #helperGridSize{width:72px;height:28px;padding:0 7px;border:1px solid #fda4af;border-radius:8px;color:#9f1239;line-height:28px}
.helper-grid-field{color:#9f1239;font-weight:700}
.grid-checks{display:flex;align-items:center;gap:12px;min-height:0;flex-wrap:wrap}
.grid-checks label{display:flex;align-items:center;gap:5px;white-space:nowrap}
label{font-size:13px}
input,select,button,textarea{font:inherit}
input[type="text"],input[type="number"],select{padding:7px 9px;border:1px solid var(--line);border-radius:10px;background:#fff}
.stack{display:flex;flex-direction:column;gap:8px}
#selectionPanel:not(.empty){display:flex;flex-direction:column;gap:18px}
.app-options-panel{display:flex;flex-direction:column;gap:12px}
.app-options-header{display:flex;align-items:center;justify-content:space-between;gap:10px}
.app-options-header .card-title{margin:0}
.app-options-header .icon-btn{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;padding:0}
.app-options-grid{display:grid;grid-template-columns:1fr;gap:10px}
.app-options-grid label{display:grid;grid-template-columns:1fr auto;align-items:center;gap:10px}
.app-options-grid select,.app-options-grid input[type="number"]{width:96px}
.app-options-grid input[type="range"]{width:128px;max-width:100%;accent-color:#2563eb}
/* Kartenansicht-Filter: breite, einheitliche Selects halten lange Firmen-/Systemgruppennamen lesbar und bleiben durch minmax auf schmalen Panels responsiv. */
.app-options-filter-grid label{grid-template-columns:minmax(96px,1fr) minmax(220px,100%)}
.app-options-filter-grid select{width:100%;min-width:220px;max-width:100%}
.app-options-grid input[type="checkbox"]{width:16px;height:16px;justify-self:end}
.obstacle-selection-panel{display:flex;flex-direction:column;gap:12px}
.obstacle-detail-grid{display:flex;flex-direction:column;gap:8px}
.detail-row{display:grid;grid-template-columns:120px minmax(0,1fr);gap:8px;align-items:center}
.detail-row-label{font-size:13px;color:#374151;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.detail-row-control{min-width:0}
.detail-row-control input,
.detail-row-control select,
.detail-row-control button{width:100%;min-height:34px}
.detail-row-control input{text-align:right}
.obstacle-history-card .stack{gap:6px}
.obstacle-history-item{width:100%;justify-content:flex-start;text-align:left;white-space:normal;line-height:1.25}
.obstacle-diagram{display:block;width:100%;height:180px;background:#fff;border:1px solid var(--line);border-radius:8px}
.obstacle-transform-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}
.obstacle-collision-panel.has-collision{border-color:#fecaca;background:#fff7f7}
.obstacle-collision-message{padding:7px 8px;border:1px solid #fecaca;border-radius:8px;background:#fff;color:#991b1b;font-size:12px;line-height:1.35}
.small-text{font-size:12px;color:var(--muted)}
.note{line-height:1.45}
.empty{font-size:13px;color:var(--muted);font-style:italic;padding:20px 0}
.card{border:1px solid var(--line);border-radius:12px;padding:10px;background:#fafafa}
.card-title{font-size:14px;font-weight:700;margin-bottom:8px}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.form-grid .full{grid-column:1 / -1}
.project-info-grid{grid-template-columns:1fr}
.project-info-grid label{display:grid;grid-template-columns:minmax(64px,82px) minmax(0,1fr);align-items:center;gap:8px}
.project-info-grid input,
.project-info-grid select,
.project-info-grid textarea{width:110%;max-width:100%;box-sizing:border-box;justify-self:end}
.kv{display:flex;justify-content:space-between;gap:8px;padding:6px 0;border-bottom:1px solid #eceff3;font-size:13px}
.modal-backdrop{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;background:rgba(17,24,39,.48);padding:24px}
.modal{background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 18px 50px rgba(0,0,0,.24);padding:14px}
.modal-title{font-size:16px;font-weight:700;margin-bottom:4px}
.pdf-import-modal{width:90vw;height:90vh;display:flex;flex-direction:column}
.pdf-preview-frame{flex:1;min-height:0;margin:12px 0;display:flex;align-items:center;justify-content:center;overflow:auto;background:#f8fafc;border:1px solid var(--line);border-radius:8px}
.pdf-preview-canvas{display:block;max-width:100%;max-height:100%;background:#fff;cursor:crosshair}
.pdf-import-controls{display:flex;align-items:end;gap:8px;flex-wrap:wrap}
.pdf-import-controls label{display:flex;flex-direction:column;gap:4px;min-width:180px}
.pdf-import-message{margin-top:10px}
.confirm-modal{width:min(420px,calc(100vw - 48px))}
.confirm-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
/* BOM-Modal: Breite und linke Position kommen weiter aus dem Zeichnungsfenster;
   vertikal spannt bom.js es als Workspace-Overlay bis an den Viewport-Rand auf,
   damit auch die Werkzeugleiste ueberdeckt wird. */
.bom-modal-root{align-items:flex-start;justify-content:flex-start;padding:0}
.bom-modal{position:absolute;left:var(--bom-modal-left,16px);top:var(--bom-modal-top,0);width:var(--bom-modal-width,min(1280px,calc(100vw - 32px)));height:var(--bom-modal-height,100vh);max-width:calc(100vw - 32px);max-height:100vh;display:flex;flex-direction:column}
.bom-modal-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:12px}
.bom-modal-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.three-d-modal-title-stack{display:flex;flex-direction:column;gap:4px;min-width:0}
.three-d-modal-message{min-height:16px;color:var(--muted);font-size:12px;line-height:1.35}
.three-d-modal-body{position:relative;display:flex;flex:1;min-height:0;border:1px solid var(--line);border-radius:8px;background:#f8fafc;overflow:hidden}
.three-d-modal-viewer{position:relative;flex:1;min-width:0;min-height:0}
.three-d-modal-viewer #view3d{width:100%;height:100%;display:block}
.view-cube-host{position:absolute;top:22px;right:22px;z-index:7;width:208px;height:208px;pointer-events:none;background:transparent;border:0;box-shadow:none;overflow:visible}
.view-cube-host.is-active{pointer-events:auto}
.view-cube-host canvas{width:100%;height:100%;display:block;cursor:pointer;touch-action:none;background:transparent}
.three-d-modal-placeholder{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:24px;color:var(--muted);font-size:13px;pointer-events:none}
.three-d-modal-viewer #view3d:not(.hidden) + .three-d-modal-placeholder{display:none}
.ar-modal-root{z-index:1100;background:rgba(17,24,39,.62);padding:24px}
.ar-modal{width:min(980px,calc(100vw - 48px));max-height:min(760px,calc(100vh - 48px));display:flex;flex-direction:column}
.ar-modal-header{margin-bottom:12px}
.ar-modal-message{min-height:16px;color:var(--muted);font-size:12px;line-height:1.35}
.ar-export-modal{gap:0}
.ar-export-list{display:flex;flex-direction:column;gap:10px;overflow:auto}
.ar-qr-layout{display:grid;grid-template-columns:288px minmax(0,1fr);gap:16px;align-items:start;min-height:0;overflow:auto}
.ar-qr-panel{display:flex;flex-direction:column;align-items:center;gap:10px;border:1px solid var(--line);border-radius:8px;background:#fff;padding:18px}
.ar-qr-canvas{width:248px;height:248px;display:block;border-radius:6px;background:#fff}
.ar-qr-fallback{font-size:12px;line-height:1.4;color:#b45309;text-align:center}
.ar-qr-info{display:flex;flex-direction:column;gap:10px;min-width:0}
.ar-qr-info .ar-export-row{display:block}
.ar-export-row{display:grid;grid-template-columns:110px minmax(0,1fr) auto;gap:14px;align-items:center;border:1px solid var(--line);border-radius:8px;background:#f8fafc;padding:12px}
.ar-export-row.is-disabled{background:#f3f4f6;color:#6b7280}
.ar-export-platform{font-size:13px;font-weight:700;color:#111827}
.ar-export-row.is-disabled .ar-export-platform{color:#4b5563}
.ar-export-details{min-width:0}
.ar-export-title{font-size:14px;font-weight:700;margin-bottom:3px;color:#111827}
.ar-export-note{font-size:12px;line-height:1.4;color:#4b5563}
.ar-export-meta{margin-top:5px;font-size:11px;color:#6b7280;word-break:break-word}
.ar-export-actions{display:flex;justify-content:flex-end}
.ar-export-actions .btn{white-space:normal;text-align:center}
.ar-viewer-url-field{width:100%;min-height:72px;margin-top:8px;resize:vertical;font-family:ui-monospace,SFMono-Regular,Consolas,'Liberation Mono',monospace;font-size:11px;line-height:1.45;color:#111827;background:#fff}
.ar-publish-warning{margin-top:12px;border:1px solid #facc15;border-radius:8px;background:#fffbeb;color:#92400e;padding:10px 12px;font-size:12px;line-height:1.4}
.bom-view-toggle{display:flex;gap:6px;align-items:center;justify-content:center;flex-wrap:wrap}
.bom-view-toggle .btn.is-active,.bom-view-toggle .btn.is-active:hover{background:#e5e7eb;border-color:#9ca3af;color:#111827}
.bom-modal-body{display:grid;grid-template-columns:260px 1fr;gap:16px;min-height:0;flex:1}
.bom-sidebar{display:flex;flex-direction:column;gap:12px;min-height:0;border-right:1px solid var(--line);padding-right:14px;overflow:hidden}
.bom-group-panel{display:flex;flex:1 1 auto;flex-direction:column;min-height:0}
.bom-group-list{display:flex;flex-direction:column;gap:8px;min-height:0;overflow:auto}
.bom-group-option{display:flex;align-items:center;gap:8px;border:1px solid var(--line);border-radius:8px;background:#fafafa;padding:8px 10px}
/* Die BOM-Inhalte scrollen innerhalb des grossen Modals; Tabellenkopf und
   Totalzeilen bleiben dadurch beim Durchsehen vieler Positionen sichtbar. */
.bom-print-area{overflow:auto;min-width:0;min-height:0;padding-right:4px}
.bom-list-area{overflow:auto}
.bom-plan-controls{padding:10px;border:1px solid var(--line);border-radius:8px;background:#fafafa;flex:0 0 auto}
.bom-plan-card-body{display:flex;flex-direction:column;gap:10px;align-items:stretch}
.bom-plan-options{min-width:0}
.bom-plan-control-grid{display:flex;flex-direction:column;gap:8px;align-items:stretch;margin-bottom:8px}
.bom-plan-control-grid label{display:flex;flex-direction:column;gap:4px}
.bom-plan-control-grid input,.bom-plan-control-grid select{height:32px;border-radius:8px}
.bom-plan-control-grid .btn{width:100%}
.bom-plan-preview-host{width:100%;max-width:100%;align-self:stretch}
.bom-plan-preview{min-height:118px;display:flex;align-items:center;justify-content:center}
.bom-plan-preview-page{width:100%;max-width:150px;max-height:176px;aspect-ratio:210 / 297;display:flex;align-items:stretch;justify-content:stretch;padding:5px;border:1px solid #cbd5e1;background:#fff;box-shadow:0 1px 4px rgba(15,23,42,.08);overflow:hidden}
.bom-plan-preview-landscape .bom-plan-preview-page{aspect-ratio:297 / 210}
.bom-plan-preview .bom-plan-page{width:100%;height:100%;display:flex;flex-direction:column;margin:0;break-before:auto;overflow:hidden}
.bom-plan-preview .bom-print-header{display:flex;align-items:flex-start;justify-content:space-between;gap:3px;margin:0 0 3px;break-after:avoid}
.bom-plan-preview .bom-print-brand{gap:3px;min-width:0}
.bom-plan-preview .bom-plan-logo{width:22%;max-width:34px;min-width:20px;height:auto}
.bom-plan-preview .bom-print-title h1{font-size:5px;line-height:1.05;margin:0}
.bom-plan-preview .bom-print-title .small-text{font-size:3.4px;line-height:1.1}
.bom-plan-preview .bom-print-meta{font-size:3.6px;line-height:1.15;text-align:right;color:#374151}
.bom-plan-preview .bom-plan-frame{flex:1;min-height:0;width:100%;height:auto;display:flex;align-items:center;justify-content:center;border:0;overflow:hidden}
.bom-plan-preview .bom-plan-frame svg{display:block;width:100%;height:100%;max-width:100%;max-height:100%;pointer-events:none}
.bom-plan-preview-empty{height:118px;border:1px dashed #cbd5e1;border-radius:6px;background:#fff}
.bom-plan-print-area{display:none}
.bom-plan-page{break-before:page}
.bom-plan-frame{width:100%;height:940px;border:1px solid var(--line)}
.bom-plan-frame svg{display:block;width:100%;height:100%}
.bom-print-header{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:16px}
.bom-print-brand{display:flex;align-items:flex-start;gap:14px;min-width:0}
.bom-print-area > .bom-print-header{display:none}
.bom-print-header h1{font-size:22px;margin:0 0 4px}
.bom-plan-logo{display:block;width:180px;height:auto}
.bom-print-meta{text-align:right;color:var(--muted);font-size:12px;line-height:1.5}
.bom-table{width:100%;table-layout:auto;border-collapse:collapse;font-size:12px}
.bom-table th,.bom-table td{border:1px solid var(--line);padding:7px 8px;text-align:left;vertical-align:top;white-space:normal;overflow:visible;text-overflow:unset;overflow-wrap:anywhere;word-break:normal}
.bom-table th{position:sticky;top:0;z-index:2;background:#f3f4f6;font-weight:700}
.bom-table tfoot td{position:sticky;bottom:0;z-index:1;font-weight:700;background:#fafafa}
.bom-table .num{text-align:right;white-space:nowrap}
.bom-table .bom-pos-header,
.bom-table .bom-pos-col{width:92px;min-width:92px;white-space:nowrap;overflow:visible;word-break:normal;overflow-wrap:normal}
.bom-pos-cell{display:grid;grid-template-columns:18px 18px 26px 26px;gap:3px;align-items:center;justify-content:start;min-height:18px}
.bom-pos-cell > *{min-width:0}
.bom-pos-arrow{appearance:none;border:0;background:transparent;color:#374151;width:18px;height:18px;padding:0;display:inline-flex;align-items:center;justify-content:center;border-radius:4px;font-size:16px;line-height:1;cursor:pointer;transform:rotate(0deg);transition:transform .12s ease,background-color .12s ease}
.bom-pos-arrow:hover{background:#e5e7eb}
.bom-pos-arrow.is-expanded{transform:rotate(90deg)}
.bom-pos-empty{display:block;width:18px;height:18px}
.bom-pos-icon{position:relative;display:inline-block;width:15px;height:15px;align-self:center}
.bom-pos-icon-article{border:1.4px solid #4b5563;border-radius:2px;background:#fff}
.bom-pos-icon-article::after{content:"";position:absolute;right:-1.4px;top:-1.4px;width:5px;height:5px;border-left:1.4px solid #4b5563;border-bottom:1.4px solid #4b5563;background:#f3f4f6}
.bom-pos-icon-folder{width:16px;height:12px;margin-top:2px;border:1.4px solid #d97706;border-radius:2px;background:#f59e0b}
.bom-pos-icon-folder::before{content:"";position:absolute;left:1px;top:-4px;width:8px;height:5px;border:1.4px solid #d97706;border-bottom:0;border-radius:2px 2px 0 0;background:#fbbf24}
.bom-pos-number{font-variant-numeric:tabular-nums;color:#111827}
.bom-assembly-child-row td{background:#fbfdff}
.bom-assembly-child-row .bom-pos-cell{grid-template-columns:18px 18px 18px 26px}
.bom-table .description-1,.bom-table .description-2{min-width:14rem}
.bom-table .bom-table-group-row td{background:#e5e7eb;font-weight:700;color:#111827}
.bom-table .bom-table-subtotal-row td{background:#f8fafc;font-weight:700;color:#111827}
.floorplan-measure-controls{display:flex;flex-direction:column;gap:8px;margin-top:10px}
.floorplan-measure-controls label{display:flex;flex-direction:column;gap:4px}
.floorplan-measure-controls .btn{width:100%}
.levels-card{display:flex;flex-direction:column;gap:12px}
.levels-environment-panel{display:flex;flex-direction:column;gap:8px}
.level-preset-strip{display:flex;align-items:stretch;gap:6px;min-width:0;flex-wrap:wrap}
.level-preset-button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;min-width:88px}
.level-preset-button small{font-size:9.5px;color:#64748b}
.level-preset-button.is-active small{color:#9a3412}
.level-environment-selects{display:grid;grid-template-columns:1fr;gap:6px}
.level-environment-selects label{display:grid;grid-template-columns:42px minmax(0,1fr);align-items:center;gap:8px;font-size:11px;color:#6b7280}
.level-environment-selects select{width:100%;min-width:0;height:28px;padding:3px 7px;font-size:11px}
.levels-visual{display:flex;flex-direction:column;gap:8px}
.levels-stack{height:260px;display:flex;flex-direction:column-reverse;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}
.levels-segment{position:relative;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border-top:1px solid rgba(255,255,255,.55);min-height:36px}
.levels-segment.ub{background:linear-gradient(135deg,#dbeafe,#bfdbfe)}
.levels-segment.db{background:#111827;color:#fff}
.levels-segment.rh{background:linear-gradient(135deg,#dcfce7,#86efac)}
.levels-segment.dp{background:#111827;color:#fff}
.levels-segment.dd{background:linear-gradient(135deg,#ede9fe,#c4b5fd)}
.levels-segment.separator-band{border-top:0;padding:1px 12px;min-height:18px}
.levels-segment.is-calculation-disabled{filter:saturate(.35);opacity:.48}
.levels-segment.is-3d-enabled::after{content:"3D";position:absolute;right:6px;top:4px;font-size:9px;font-weight:700;color:rgba(17,24,39,.58)}
.levels-segment.db.is-3d-enabled::after,.levels-segment.dp.is-3d-enabled::after{color:rgba(255,255,255,.7)}
.levels-segment.is-3d-selected{outline:2px solid #f97316;outline-offset:-2px;z-index:1}
.levels-segment-label{font-size:12px;font-weight:800;letter-spacing:.04em}
.levels-segment-value{font-size:12px;color:#374151;text-align:right}
.levels-segment.db .levels-segment-value,
.levels-segment.dp .levels-segment-value{color:rgba(255,255,255,.88)}
.levels-input-grid{display:flex;flex-direction:column;gap:8px}
.level-control-block{display:flex;flex-direction:column;gap:6px;min-width:0}
.level-input-row{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(86px,96px);align-items:center;gap:8px;min-width:0}
.level-input-name{font-size:12.5px;color:#374151;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.level-input-switches{display:flex;align-items:center;gap:5px;white-space:nowrap}
.level-mini-check{display:inline-flex;align-items:center;gap:3px;font-size:9.5px;color:#64748b;line-height:1;white-space:nowrap}
.level-mini-check input{width:12px;height:12px;margin:0}
.level-value-input{width:100%;min-width:86px;text-align:right;box-sizing:border-box}
.level-extra-options{display:grid;grid-template-columns:42px minmax(0,1fr);gap:6px 8px;align-items:center;padding-left:0}
.level-extra-label{font-size:10.5px;color:#6b7280}
.level-button-strip,.level-color-strip{display:flex;align-items:center;gap:5px;min-width:0;flex-wrap:nowrap}
.level-option-button{min-height:24px;padding:3px 6px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#374151;font-size:10.5px;line-height:1;cursor:pointer}
.level-option-button:hover{border-color:#94a3b8;background:#f8fafc}
.level-option-button.is-active{border-color:#f97316;background:#fff7ed;color:#9a3412}
.level-color-button{width:20px;height:20px;min-width:20px;padding:0;border:1px solid #cbd5e1;border-radius:4px;background:var(--level-color);cursor:pointer}
.level-color-button:hover{border-color:#94a3b8}
.level-color-button.is-active{border-color:#f97316;box-shadow:0 0 0 1px #f97316}
@media (max-width: 1400px){.app-shell{grid-template-columns:var(--left-sidebar-width-compact) minmax(0,1fr) var(--right-sidebar-width-compact)}.topbar{grid-template-columns:var(--left-header-width-compact) minmax(0,1fr)}}
@media (max-width: 1100px){
  .app-shell{grid-template-columns:clamp(128px,20vw,var(--left-sidebar-width-compact)) minmax(260px,1fr) clamp(220px,28vw,300px);grid-template-rows:minmax(0,1fr);overflow:hidden}
  .sidebar.left{grid-column:1;grid-row:1;max-height:none}
  .workspace{grid-column:2;grid-row:1}
  .sidebar.right{grid-column:3;grid-row:1;max-height:none}
  .topbar{grid-template-columns:1fr;grid-template-rows:auto auto auto}
  .header-brand-stack{grid-column:1;grid-row:1;max-width:320px}
  .header-main-row{grid-column:1;grid-row:2}
  .header-system-row{grid-column:1;grid-row:3}
}
@media (max-width: 720px){
  .app-shell{grid-template-columns:clamp(112px,22vw,160px) minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:0;padding:0}
  .sidebar.left{grid-column:1;grid-row:1}
  .workspace{grid-column:2;grid-row:1}
  .sidebar.right{display:none}
  .ar-modal-root{padding:12px}
  .ar-modal{width:calc(100vw - 24px);max-height:calc(100vh - 24px)}
  .ar-qr-layout{grid-template-columns:1fr}
  .ar-qr-panel{align-items:flex-start}
  .ar-export-row{grid-template-columns:1fr;align-items:start}
  .ar-export-actions{justify-content:flex-start}
}
@media print{
  @page{size:A4 portrait;margin:8mm}
  @page bom-list-page{size:A4 landscape;margin:8mm}
  @page bom-plan-portrait-page{size:A4 portrait;margin:8mm}
  @page bom-plan-landscape-page{size:A4 landscape;margin:8mm}
  html,body{width:auto;height:auto;overflow:visible!important;background:#fff!important}
  body.bom-list-printing,
  body.bom-plan-printing{display:block;color:#111827}
  body.bom-list-printing{page:bom-list-page}
  body.bom-plan-printing-portrait{page:bom-plan-portrait-page}
  body.bom-plan-printing-landscape{page:bom-plan-landscape-page}
  body.bom-list-printing > *:not(.bom-modal-root),
  body.bom-plan-printing > *:not(.bom-modal-root){display:none!important}
  /* Druckmodus: Nur der fachliche BOM-/Planbereich wird gedruckt; Modalrahmen,
     Sidebar, Buttons und App-Navigation werden ausgeblendet, damit nichts aus
     dem A4-Blatt laeuft. */
  body.bom-list-printing .bom-modal-root,
  body.bom-plan-printing .bom-modal-root{position:static!important;inset:auto!important;display:block!important;width:100%!important;min-height:0!important;background:#fff!important;padding:0!important}
  body.bom-list-printing .bom-modal,
  body.bom-plan-printing .bom-modal{position:static!important;display:block!important;width:100%!important;max-width:none!important;height:auto!important;max-height:none!important;border:0!important;border-radius:0!important;box-shadow:none!important;padding:0!important;overflow:visible!important}
  body.bom-list-printing .bom-modal-header,
  body.bom-plan-printing .bom-modal-header,
  body.bom-list-printing .bom-modal-actions,
  body.bom-list-printing .bom-sidebar,
  body.bom-list-printing .bom-group-panel,
  body.bom-plan-printing .bom-modal-actions,
  body.bom-plan-printing .bom-sidebar,
  body.bom-plan-printing .bom-group-panel{display:none!important}
  body.bom-list-printing .bom-modal-body,
  body.bom-plan-printing .bom-modal-body{display:block!important;min-height:0!important}
  body.bom-list-printing .bom-print-area,
  body.bom-plan-printing .bom-print-area{display:block!important;overflow:visible!important;width:100%!important;max-width:100%!important;min-width:0!important;padding:0!important}
  body.bom-list-printing .bom-print-area > .bom-print-header{display:flex!important;align-items:flex-start;justify-content:space-between;margin:0 0 5mm!important;break-after:avoid}
  body.bom-list-printing .bom-plan-controls,
  body.bom-list-printing .bom-plan-print-area,
  body.bom-plan-printing .bom-print-area > .bom-print-header,
  body.bom-plan-printing .bom-plan-controls,
  body.bom-plan-printing #bomTableHost{display:none!important}

  /* BOM/Liste: feste Tabellenbreiten, umbrechende Texte und wiederholte
     Kopfzeilen halten die breite Stueckliste lesbar auf A4 quer. */
  body.bom-list-printing .bom-table{width:100%!important;max-width:100%!important;table-layout:auto;border-collapse:collapse;font-size:7.3pt;line-height:1.18;page-break-inside:auto}
  body.bom-list-printing .bom-table thead{display:table-header-group}
  body.bom-list-printing .bom-table tbody{display:table-row-group}
  body.bom-list-printing .bom-table tfoot{display:table-row-group}
  body.bom-list-printing .bom-table tr{break-inside:avoid;page-break-inside:avoid}
  body.bom-list-printing .bom-table th,
  body.bom-list-printing .bom-table td{position:static!important;border:0.35pt solid #9ca3af;padding:2.2pt 2.6pt;vertical-align:top;background:#fff;white-space:normal;overflow-wrap:anywhere;word-break:break-word}
  body.bom-list-printing .bom-table th{font-weight:700;background:#eef2f7!important}
  body.bom-list-printing .bom-table .bom-table-group-row td{background:#e5e7eb!important;font-weight:700}
  body.bom-list-printing .bom-table .bom-table-subtotal-row td{background:#f8fafc!important;font-weight:700}
  body.bom-list-printing .bom-table .num{text-align:right;white-space:nowrap;word-break:normal}
  body.bom-list-printing .bom-table .bom-pos-header,
  body.bom-list-printing .bom-table .bom-pos-col{width:18mm;min-width:18mm;white-space:nowrap;word-break:normal;overflow-wrap:normal}
  body.bom-list-printing .bom-pos-cell{grid-template-columns:3.5mm 3.5mm 5mm 5mm;gap:1mm;min-height:4mm}
  body.bom-list-printing .bom-pos-arrow{width:3.5mm;height:3.5mm;font-size:8pt}
  body.bom-list-printing .bom-pos-empty{width:3.5mm;height:3.5mm}
  body.bom-list-printing .bom-pos-icon{width:3mm;height:3mm}
  body.bom-list-printing .bom-pos-icon-folder{width:3.4mm;height:2.6mm;margin-top:.5mm}
  body.bom-list-printing .bom-pos-icon-folder::before{top:-1.2mm;width:2.2mm;height:1.4mm}
  body.bom-list-printing .bom-table .description-1,
  body.bom-list-printing .bom-table .description-2{min-width:0}
  body.bom-list-printing .bom-table tfoot td{font-weight:700;background:#f8fafc!important;break-inside:avoid}

  /* Plan: A4-Hoch- und Querformat nutzen den jeweiligen Druckbereich, die
     SVG-Zeichnung bleibt proportional und zentriert. */
  body.bom-plan-printing .bom-plan-print-area{display:block!important;width:100%!important}
  body.bom-plan-printing .bom-plan-page{break-before:auto!important;break-after:auto!important;width:100%;height:auto;margin:0}
  body.bom-plan-printing .bom-plan-page .bom-print-header{display:flex!important;align-items:flex-start;justify-content:space-between;margin:0 0 4mm!important;break-after:avoid}
  body.bom-plan-printing .bom-plan-frame{display:flex;align-items:center;justify-content:center;width:100%;height:258mm;border:0!important;overflow:hidden}
  body.bom-plan-printing-landscape .bom-plan-frame{height:176mm}
  body.bom-plan-printing .bom-plan-frame svg{display:block;width:100%!important;height:100%!important;max-width:100%;max-height:100%}
  body.bom-list-printing .bom-plan-logo,
  body.bom-plan-printing .bom-plan-logo{width:42mm;height:auto}
  body.bom-list-printing .bom-print-meta,
  body.bom-plan-printing .bom-print-meta{font-size:8pt;line-height:1.25;color:#374151;text-align:right}
}
