*{box-sizing:border-box}
:root{
  --bg:#e9edf2;--panel:#fff;--ink:#1d232b;--muted:#6b7582;--line:#d6dce3;
  --accent:#20800d;--accent2:#0d49a5;--dark:#20252c;--guide:rgba(30,112,220,.35)
}
html,body{margin:0;height:100%;font-family:Arial,Helvetica,sans-serif;color:var(--ink);background:var(--bg)}
button,select,input,textarea{font:inherit}
button{border:1px solid #bfc7d1;background:#fff;border-radius:7px;padding:7px 10px;cursor:pointer}
button:hover{background:#f4f7fa}button:disabled{opacity:.4;cursor:default}
button.primary{background:var(--accent);border-color:var(--accent);color:#fff}
button.primary:hover{background:var(--accent2)}
select,input[type="text"],input[type="number"],textarea{border:1px solid var(--line);border-radius:6px;background:#fff;padding:7px}
.topbar{height:62px;display:flex;align-items:center;gap:18px;padding:8px 14px;background:var(--dark);color:#fff;box-shadow:0 2px 10px rgba(0,0,0,.2);position:relative;z-index:1000}
.brand{display:flex;align-items:center;gap:9px;min-width:170px}.brand small{display:block;font-size:10px;color:#9fabb8;margin-top:1px}
.brand-logo{width:31px;height:31px;display:block;object-fit:contain;border-radius:6px;flex:0 0 31px;background:transparent}
.toolbar{display:flex;align-items:center;gap:6px;overflow:auto;white-space:nowrap}.toolbar .sep{width:1px;height:28px;background:#59616b;margin:0 3px}.toolbar select{max-width:125px}
.shell{display:grid;grid-template-columns:185px 1fr 310px;height:calc(100vh - 62px)}
.pages-panel,.properties{background:var(--panel);overflow:auto}
.pages-panel{border-right:1px solid var(--line);padding:12px}.properties{border-left:1px solid var(--line);padding:15px}
.panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}.row-tight{display:flex;gap:4px}.row-tight button{padding:4px 8px}
.mini-label{display:block;font-size:11px;color:var(--muted);margin-bottom:12px}.mini-label select{width:100%;margin-top:4px}
.page-thumbs{display:flex;flex-direction:column;gap:12px}
.thumb{border:2px solid transparent;border-radius:8px;padding:6px;cursor:pointer;background:#f8fafc}
.thumb.active{border-color:var(--accent);background:#eef5ff}
.thumb-preview{position:relative;margin:auto;background:#fff;box-shadow:0 2px 7px rgba(0,0,0,.14);overflow:hidden}
.thumb-label{display:flex;justify-content:space-between;align-items:center;margin-top:6px;font-size:11px;color:var(--muted)}
.thumb-actions{display:flex;gap:3px}.thumb-actions button{font-size:10px;padding:2px 5px}
.thumb-block{position:absolute;background:#bac5d1;border-radius:1px}.thumb-block.image{background:#8798aa}.thumb-block.shape{opacity:.5}
.workspace{overflow:auto;position:relative}.workspace-bar{position:sticky;top:0;z-index:500;display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:rgba(233,237,242,.94);backdrop-filter:blur(5px);border-bottom:1px solid #d8dee5}
.zoom-group{display:flex;align-items:center;gap:7px}.zoom-group button{padding:4px 8px}.zoom-group input{width:145px}.zoom-group span{font-size:12px;color:var(--muted);width:48px}
.workspace-help{display:flex;align-items:center;gap:14px}
.mouse-hint{font-size:11px;color:#4e5b68;background:#fff;border:1px solid #d6dce3;border-radius:999px;padding:5px 9px}
.workspace-status{font-size:11px;color:var(--muted)}
.canvas-host{display:flex;justify-content:center;align-items:flex-start;gap:18px;padding:38px 50px 100px;transform-origin:top center}
.page-wrap{position:relative;flex:0 0 auto}
.page-stage{position:relative;box-sizing:border-box}
.spread-gap{width:8mm}
.page{--pw:210;--ph:297;position:absolute;width:calc(var(--pw)*1mm);height:calc(var(--ph)*1mm);background:#fff;box-shadow:0 7px 28px rgba(0,0,0,.18);overflow:hidden;user-select:none}
.page-label{position:absolute;left:0;top:-24px;color:var(--muted);font-size:12px}
.trim-outline{position:absolute;border:1px dashed rgba(110,118,128,.75);pointer-events:none;z-index:820;box-sizing:border-box}
.bleed-zone{position:absolute;background:rgba(255,0,0,.39);pointer-events:none;z-index:840;display:flex;align-items:center;justify-content:center;overflow:hidden}
.bleed-zone::after{content:"";position:absolute;inset:0;border:1px dashed rgba(170,0,0,.68);box-sizing:border-box}
.bleed-zone.top::before,.bleed-zone.bottom::before,.bleed-zone.left::before,.bleed-zone.right::before{content:"✂";color:rgba(140,0,0,.92);font-size:12px;line-height:1;background:rgba(255,255,255,.58);border-radius:999px;padding:1px 4px;box-shadow:0 0 0 1px rgba(170,0,0,.18)}
.bleed-zone.left::before,.bleed-zone.right::before{transform:rotate(90deg)}
.guides{position:absolute;inset:0;pointer-events:none;z-index:800}.margin-guide{position:absolute;border:1px dashed var(--guide)}.column-guide{position:absolute;top:0;bottom:0;border-left:1px dashed rgba(30,112,220,.22)}
.master-header,.master-footer{position:absolute;left:0;right:0;font-size:8pt;color:#666;z-index:50;pointer-events:none}.master-header{text-align:center;top:5mm}.master-footer{text-align:center;bottom:5mm}
.item{position:absolute;min-width:5mm;min-height:5mm;outline:1px solid transparent;user-select:none}.item.selected{outline:2px solid var(--accent)}.item.multi-selected{outline:2px dashed #6f42c1}
.item .content{width:100%;height:100%;overflow:hidden}.item.text .content{padding:1mm;white-space:pre-wrap;overflow-wrap:break-word;outline:none;user-select:text;tab-size:4;-moz-tab-size:4}.item.text .content[contenteditable="true"]{cursor:text;background:rgba(255,250,220,.35)}
.item.text .content[contenteditable="false"]{cursor:grab}
.item.text.dragging .content{cursor:grabbing}
.move-grip{
  display:none;position:absolute;left:-5px;top:-5px;z-index:1002;
  width:16px;height:16px;border-radius:4px;border:1px solid #fff;
  background:var(--accent);color:#fff;font-size:11px;line-height:14px;text-align:center;
  cursor:grab;box-shadow:0 1px 4px rgba(0,0,0,.22);user-select:none
}
.item.selected.text .move-grip,.item.multi-selected.text .move-grip{display:block}
.item.text.editing{outline:2px solid #e0a100!important}
.item.text.editing .move-grip{display:block;background:#e0a100}

.item.image .content{overflow:hidden}.item.image img{width:100%;height:100%;display:block;pointer-events:none;transform-origin:center}
.item.shape .content{width:100%;height:100%}
.resize-handle{display:none;position:absolute;right:-5px;bottom:-5px;width:11px;height:11px;background:var(--accent);border:1px solid #fff;border-radius:2px;cursor:nwse-resize}.item.selected .resize-handle{display:block}
.flow-badge,.group-badge{position:absolute;right:2px;top:2px;background:rgba(18,97,216,.88);color:#fff;font-size:9px;padding:2px 4px;border-radius:3px;pointer-events:none}.group-badge{top:auto;bottom:2px;background:rgba(111,66,193,.88)}
.properties section{padding-bottom:16px;margin-bottom:16px;border-bottom:1px solid var(--line)}.properties h3{font-size:14px;margin:0 0 11px}
.properties label{display:block;font-size:12px;margin:0 0 10px;color:#4f5965}.properties input,.properties select,.properties textarea{width:100%;margin-top:5px}.properties input[type="checkbox"]{width:auto;margin:0 6px 0 0}.properties input[type="color"]{height:33px;padding:2px}.properties .check{display:flex;align-items:center}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:8px}.grid4{display:grid;grid-template-columns:repeat(4,1fr);gap:5px}.row{display:flex;gap:5px;flex-wrap:wrap}.row button{flex:1;padding:6px}
.hidden{display:none!important}.micro{font-size:11px;color:var(--muted);line-height:1.35;margin:-3px 0 8px}.status-line{font-size:11px;color:var(--muted);margin-top:6px}
.info-box{font-size:11px;line-height:1.45;color:#53606d;background:#f4f7fa;border:1px solid #e2e7ed;border-radius:6px;padding:8px}
.image-editor-dialog{width:min(1050px,96vw)}
.image-editor-body{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:16px;align-items:start}
.image-editor-canvas-wrap{min-width:0}
#imageEditCanvas{display:block;max-width:100%;max-height:68vh;width:auto;height:auto;background:#fff;border:1px solid #d6dce3;border-radius:8px;box-shadow:0 2px 10px rgba(0,0,0,.08)}
.image-editor-tools{display:flex;flex-direction:column;gap:10px}
.image-editor-tools .row{display:flex;gap:6px;flex-wrap:wrap}
.image-editor-tools .row button{flex:1}
@media(max-width:900px){.image-editor-body{grid-template-columns:1fr}}
dialog{border:0;border-radius:12px;padding:0;box-shadow:0 20px 65px rgba(0,0,0,.35);width:min(590px,90vw)}dialog::backdrop{background:rgba(15,22,31,.45)}
.dialog-card{padding:0}.dialog-head{display:flex;align-items:center;justify-content:space-between;padding:15px 18px;border-bottom:1px solid var(--line)}.dialog-head h2{font-size:18px;margin:0}.dialog-head button{border:0;font-size:22px}
.dialog-body,#preflightResults{padding:18px}.checkline{display:flex;gap:10px;align-items:flex-start;padding:7px 0;border-bottom:1px solid #edf0f4}.checkline:last-child{border-bottom:0}.ok{color:#16834a}.warn{color:#b16a00}.bad{color:#bb2d3b}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;padding:12px 18px;border-top:1px solid var(--line)}
@media(max-width:1100px){.shell{grid-template-columns:150px 1fr}.properties{position:fixed;right:0;top:62px;bottom:0;width:290px;z-index:950;box-shadow:-5px 0 20px rgba(0,0,0,.08)}.workspace{padding-right:290px}}
@media print{
  @page{margin:0}
  html,body{background:#fff}
  .topbar,.pages-panel,.properties,.workspace-bar,.page-label,.guides,.resize-handle,.rotate-handle,.rotation-angle-badge,.flow-badge,.group-badge,.move-grip,dialog,.bleed-zone{display:none!important}
  .shell{display:block;height:auto}.workspace{padding:0;overflow:visible}.canvas-host{display:block!important;padding:0!important;transform:none!important}
  .page-wrap{margin:0!important;break-after:page;page-break-after:always}.page-stage{box-shadow:none!important}.page{box-shadow:none;overflow:hidden}.trim-outline{display:none!important}.item.selected,.item.multi-selected{outline:none!important}
}

.rich-hint{background:#eef5ff;border:1px solid #d3e3ff;border-radius:6px;padding:8px;margin-bottom:10px!important}
.item.text .content span{box-decoration-break:clone;-webkit-box-decoration-break:clone}

.item.line .content{overflow:visible}
.item.line .line-stroke{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);border-top-style:solid}
.item.table .content{overflow:hidden;background:#fff}
.layout-table{border-collapse:collapse;width:100%;height:100%;table-layout:fixed;font-size:10pt}
.layout-table td{padding:1.2mm;vertical-align:top;overflow:hidden;outline:none}
.layout-table.editing td{cursor:text}
.layout-table:not(.editing) td{cursor:grab}
.layers-list{display:flex;flex-direction:column;gap:4px}
.layer-row{display:grid;grid-template-columns:20px 28px 28px 1fr;gap:4px;align-items:center;border:1px solid #e0e5eb;border-radius:6px;padding:4px;background:#fafbfd;font-size:11px}
.layer-row.active{border-color:var(--accent);background:#eef5ff}
.layer-row button{padding:3px 5px;font-size:11px}
.layer-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
/* V43.49 TEST: Gesperrte Objekte bleiben sichtbar erkennbar.
   Unausgewählt erscheint der bestehende 1-px-Rahmen in Cyan; bei Auswahl
   übernimmt derselbe Farbwert automatisch die 2-px-Auswahlkontur. */
.item.locked{outline-color:#22beed!important}
.item.locked.selected,.item.locked.multi-selected{outline-color:#22beed!important}
.item.locked .resize-handle,.item.locked .move-grip{display:none!important}

.item.image .content{
  transition:clip-path .12s ease,border-radius .12s ease;
}
.image-shape-note{
  font-size:11px;
  color:var(--muted);
}

.item.pdf .content{overflow:hidden;background:#f3f3f3}
.item.pdf img{width:100%;height:100%;display:block;pointer-events:none;transform-origin:center center}
.pdf-badge{position:absolute;left:2px;bottom:2px;background:rgba(45,52,61,.88);color:#fff;font-size:9px;padding:2px 4px;border-radius:3px;pointer-events:none}
.pdf-place-dialog{width:min(980px,96vw)}
.pdf-page-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(125px,1fr));gap:12px;margin-top:14px}
.pdf-page-card{border:2px solid transparent;border-radius:8px;padding:7px;background:#f7f9fb;cursor:pointer}
.pdf-page-card:hover{background:#eef3f8}
.pdf-page-card.selected{border-color:var(--accent);background:#eef5ff}
.pdf-page-card canvas{display:block;max-width:100%;height:auto;margin:auto;background:#fff;box-shadow:0 2px 7px rgba(0,0,0,.15)}
.pdf-page-card div{font-size:11px;text-align:center;color:var(--muted);margin-top:5px}
.pdf-loading{opacity:.65}

.bleed-warning-icon{
  width:48px;height:48px;border-radius:50%;
  display:grid;place-items:center;
  margin:0 0 12px;
  background:rgba(128,128,128,.18);
  border:1px solid rgba(90,90,90,.28);
  font-size:24px
}

.rotate-handle{
  display:none;
  position:absolute;
  left:50%;
  top:-29px;
  width:15px;
  height:15px;
  margin-left:-7.5px;
  border-radius:50%;
  background:var(--accent);
  border:2px solid #fff;
  box-shadow:0 1px 5px rgba(0,0,0,.28);
  cursor:grab;
  z-index:1010;
  touch-action:none;
}
.rotate-handle::after{
  content:"";
  position:absolute;
  left:50%;
  top:13px;
  width:1px;
  height:15px;
  background:var(--accent);
  transform:translateX(-50%);
}
.item.selected.rotation-enabled .rotate-handle{display:block}
.item.rotating .rotate-handle{cursor:grabbing}
.item.locked .rotate-handle{display:none!important}
.rotation-angle-badge{
  display:none;
  position:absolute;
  left:50%;
  top:-54px;
  transform:translateX(-50%);
  background:rgba(28,34,42,.9);
  color:#fff;
  padding:3px 7px;
  border-radius:5px;
  font-size:10px;
  white-space:nowrap;
  z-index:1012;
  pointer-events:none;
}
.item.rotating .rotation-angle-badge{display:block}

.frame-overlay{
  position:absolute;
  pointer-events:none;
  z-index:1;
  overflow:visible;
}
.frame-overlay svg{
  width:100%;
  height:100%;
  display:block;
  overflow:visible;
}
.frame-overlay path,
.frame-overlay rect,
.frame-overlay circle,
.frame-overlay ellipse,
.frame-overlay polygon{
  stroke:none;
}
.item>.content{
  position:relative;
  z-index:2;
}
.shadow-overlay{
  z-index:0!important;
}

.shadow-overlay{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:-1;
}
.shadow-overlay svg{
  width:100%;
  height:100%;
  display:block;
  overflow:visible;
}
.shadow-overlay path,
.shadow-overlay rect,
.shadow-overlay circle,
.shadow-overlay ellipse,
.shadow-overlay polygon{
  stroke:none;
}

#textBackgroundControls input[type="color"]:disabled{
  opacity:.45;
}

.text-bg-overlay{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:1;
}
.text-bg-overlay svg{
  width:100%;
  height:100%;
  display:block;
}
.item.text>.content{
  position:relative;
  z-index:2;
  background:transparent!important;
}
.frame-overlay{
  z-index:3;
}
.rotate-handle,.rotation-angle-badge,.resize-handle,.move-grip{
  z-index:1010;
}
@media print{
  *{
    -webkit-print-color-adjust:exact!important;
    print-color-adjust:exact!important;
  }
}

.layout-grid{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:790;
  background-image:
    linear-gradient(to right, rgba(70,90,115,.13) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(70,90,115,.13) 1px, transparent 1px);
  background-size:10mm 10mm;
  background-position:0 0;
}
@media print{
  .layout-grid{display:none!important}
}

.template-placeholder-box{
  margin:10px 0;
  padding:9px;
  border:1px solid var(--line,#d5d9df);
  border-radius:8px;
  background:rgba(90,110,135,.05);
}
.image-placeholder{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:8px;
  box-sizing:border-box;
  background:
    linear-gradient(45deg,rgba(120,130,140,.09) 25%,transparent 25%) 0 0/12px 12px,
    linear-gradient(-45deg,rgba(120,130,140,.09) 25%,transparent 25%) 0 6px/12px 12px,
    linear-gradient(45deg,transparent 75%,rgba(120,130,140,.09) 75%) 6px -6px/12px 12px,
    linear-gradient(-45deg,transparent 75%,rgba(120,130,140,.09) 75%) -6px 0/12px 12px,
    #f4f6f8;
  color:#66717e;
  font:600 10pt/1.2 system-ui,sans-serif;
}
.image-placeholder::before{content:"▧ ";font-size:16px;margin-right:5px}
.template-library-dialog{width:min(1100px,94vw);max-width:1100px}
.template-save-dialog{width:min(650px,92vw)}
.template-library-toolbar{
  display:grid;
  grid-template-columns:minmax(180px,1fr) minmax(150px,220px) auto;
  gap:10px;
  align-items:end;
  margin-bottom:14px;
}
.template-library-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(230px,1fr));
  gap:14px;
  max-height:62vh;
  overflow:auto;
  padding:2px;
}
.template-card{
  border:1px solid var(--line,#d5d9df);
  border-radius:10px;
  overflow:hidden;
  background:#fff;
  box-shadow:0 2px 8px rgba(0,0,0,.05);
}
.template-card-preview{
  height:180px;
  background:#e9edf1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:10px;
  box-sizing:border-box;
}
.template-mini-page{
  position:relative;
  background:#fff;
  box-shadow:0 1px 6px rgba(0,0,0,.20);
  overflow:hidden;
}
.template-mini-item{position:absolute;overflow:hidden;box-sizing:border-box}
.template-mini-item.text{font:600 5px/1.05 system-ui,sans-serif;color:#303843;padding:1px}
.template-mini-item.image,.template-mini-item.pdf{background:#bcc5ce}
.template-mini-item.shape{opacity:.75}
.template-card-body{padding:11px}
.template-card-title{font-weight:750;font-size:14px;margin-bottom:3px}
.template-card-meta{font-size:11px;color:#68717c;margin-bottom:7px}
.template-card-desc{font-size:12px;min-height:30px;color:#3c4650}
.template-card-actions{display:flex;flex-wrap:wrap;gap:5px;margin-top:9px}
.template-card-actions button{font-size:11px;padding:5px 7px}
.template-badge{display:inline-block;padding:2px 6px;border-radius:999px;background:#eef2f6;font-size:10px;margin-right:4px}
#templateCountBadge:not(:empty)::before{content:"("}
#templateCountBadge:not(:empty)::after{content:")"}
@media (max-width:760px){.template-library-toolbar{grid-template-columns:1fr}.template-library-dialog{width:96vw}}
@media print{.image-placeholder{display:none!important}}


/* Version 15 – Broschüren-/Doppelseiten-Vorschau */
.preview-warning-icon{
  font-size:34px;
  line-height:1;
  margin:0 0 10px;
}
.publication-preview-dialog{
  width:min(96vw,1500px);
  height:94vh;
  max-width:none;
  max-height:none;
  padding:0;
  border:0;
  border-radius:12px;
  overflow:hidden;
}
.publication-preview-dialog::backdrop{
  background:rgba(18,23,29,.76);
}
.publication-preview-shell{
  height:100%;
  display:flex;
  flex-direction:column;
  background:#dfe4ea;
}
.publication-preview-head{
  flex:0 0 auto;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
  padding:12px 16px;
  background:#fff;
  border-bottom:1px solid #cfd6de;
  box-shadow:0 2px 10px rgba(0,0,0,.06);
  z-index:5;
}
.publication-preview-head h2{margin:0 0 2px}
.publication-preview-host{
  flex:1 1 auto;
  overflow:auto;
  padding:34px 38px 70px;
}
.preview-spread-row{
  width:max-content;
  min-width:min(100%,1200px);
  margin:0 auto 38px;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  gap:0;
}
.preview-spread-row.preview-first{
  justify-content:flex-end;
}
.preview-spread-row.preview-last{
  justify-content:flex-start;
}
.preview-page-card{
  flex:0 0 auto;
}
.preview-page-label{
  text-align:center;
  font-size:12px;
  color:#46515d;
  margin-top:8px;
}
.preview-page-viewport{
  position:relative;
  overflow:visible;
}
.preview-page-viewport .page-stage{
  position:absolute!important;
  left:0;
  top:0;
  transform-origin:top left;
}
.publication-preview-dialog .page{
  box-shadow:0 9px 30px rgba(0,0,0,.23);
}
.publication-preview-dialog .page-stage,
.publication-preview-dialog .page{
  pointer-events:none!important;
}
.publication-preview-dialog .guides,
.publication-preview-dialog .layout-grid,
.publication-preview-dialog .bleed-zone,
.publication-preview-dialog .trim-outline,
.publication-preview-dialog .resize-handle,
.publication-preview-dialog .rotate-handle,
.publication-preview-dialog .rotation-angle-badge,
.publication-preview-dialog .move-grip,
.publication-preview-dialog .flow-badge,
.publication-preview-dialog .group-badge{
  display:none!important;
}
.publication-preview-dialog .item.selected,
.publication-preview-dialog .item.multi-selected{
  outline:none!important;
}
.preview-missing-page{
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px dashed #9aa5b1;
  background:rgba(255,255,255,.35);
  color:#697684;
  font-size:12px;
  text-align:center;
}
@media(max-width:900px){
  .publication-preview-host{padding:24px 12px 60px}
  .publication-preview-head{align-items:flex-start;flex-direction:column}
}

.preview-spread-row.preview-inner .preview-page-card:first-child .preview-page-viewport{
  box-shadow:1px 0 0 rgba(0,0,0,.10);
  z-index:2;
}
.preview-spread-row.preview-inner .preview-page-card + .preview-page-card{
  margin-left:0!important;
}


/* Version 15.3 – Font-Picker mit echter Schriftvorschau */
.font-picker{
  position:relative;
  margin:0 0 10px;
}
.font-family-native{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  opacity:0!important;
  pointer-events:none!important;
  overflow:hidden!important;
}
.font-picker-button{
  width:100%;
  min-height:38px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:7px 10px;
  border:1px solid var(--line);
  border-radius:6px;
  background:#fff;
  color:#1e2630;
  text-align:left;
  cursor:pointer;
}
.font-picker-button:hover,
.font-picker-button:focus{
  border-color:#8e9aa7;
  outline:none;
}
.font-picker-current{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.font-picker-arrow{
  flex:0 0 auto;
  font-family:system-ui,sans-serif;
  opacity:.65;
}
.font-picker-menu{
  position:fixed;
  z-index:6000;
  overflow:auto;
  overscroll-behavior:contain;
  background:#fff;
  border:1px solid #bfc7d0;
  border-radius:8px;
  box-shadow:0 10px 30px rgba(0,0,0,.22);
  padding:5px;
}
.font-picker-menu.hidden{
  display:none!important;
}
.font-picker-option{
  width:100%;
  display:block;
  border:0;
  background:transparent;
  border-radius:5px;
  padding:6px 8px;
  text-align:left;
  font-size:15px;
  line-height:1.2;
  color:#202832;
  cursor:pointer;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.font-picker-option:hover,
.font-picker-option.active{
  background:#edf4ff;
}
.font-picker-empty{
  padding:12px;
  color:#7a8591;
  font-size:12px;
}


/* Version 15.4 – obere Werkzeugleiste als linkes Menü */
.topbar{
  height:54px;
  padding:7px 14px;
}
.topbar .brand{
  min-width:0;
}
.shell{
  grid-template-columns:235px minmax(0,1fr) 310px;
  height:calc(100vh - 54px);
}
.pages-panel{
  padding:0;
  display:flex;
  flex-direction:column;
  overflow:auto;
}
.left-tools{
  padding:12px 10px 10px;
  border-bottom:1px solid var(--line);
  background:#f8fafc;
}
.left-tools-title{
  font-size:14px;
  font-weight:700;
  margin:0 4px 9px;
  color:#303944;
}
.tool-menu-group{
  margin:0 0 7px;
  border:1px solid #dce2e8;
  border-radius:8px;
  background:#fff;
  overflow:hidden;
}
.tool-menu-group summary{
  list-style:none;
  position:relative;
  padding:8px 28px 8px 10px;
  font-size:12px;
  font-weight:700;
  color:#46515d;
  cursor:pointer;
  user-select:none;
  background:#f7f9fb;
}
.tool-menu-group summary::-webkit-details-marker{
  display:none;
}
.tool-menu-group summary::after{
  content:"▸";
  position:absolute;
  right:10px;
  top:7px;
  font-size:13px;
  color:#7b8692;
  transition:transform .12s ease;
}
.tool-menu-group[open] summary::after{
  transform:rotate(90deg);
}
.tool-menu-body{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:8px;
  border-top:1px solid #e8ecf0;
}
.tool-menu-body button,
.tool-menu-body select{
  width:100%;
  min-width:0;
  margin:0;
  font-size:11px;
  padding:7px 7px;
}
.tool-grid-2{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:6px;
}
.tool-grid-2 > button{
  min-width:0;
  white-space:normal;
}
button.danger-soft{
  color:#a32631;
  border-color:#e2bfc3;
  background:#fff8f8;
}
button.danger-soft:hover{
  background:#ffeded;
}
.pages-section{
  padding:12px;
}
.pages-section .panel-head{
  margin-bottom:10px;
}
.pages-section .mini-label{
  margin-bottom:12px;
}

/* Alte horizontale Toolbar wird in V15.4 nicht mehr verwendet. */
.toolbar{display:none!important}

@media(max-width:1100px){
  .shell{
    grid-template-columns:215px minmax(0,1fr);
  }
  .properties{
    top:54px;
  }
}
@media(max-width:760px){
  .shell{
    grid-template-columns:190px minmax(0,1fr);
  }
  .left-tools{
    padding-left:7px;
    padding-right:7px;
  }
  .tool-grid-2{
    grid-template-columns:1fr;
  }
}


/* Version 19.6 – breitenadaptive Vorschau ohne horizontalen Scrollbalken */
.publication-preview-host{
  display:block;
  overflow-x:hidden;
  overflow-y:auto;
  padding:30px 34px 70px;
}
.preview-continuous-strip{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  width:100%;
  min-width:0;
  max-width:100%;
}
.preview-content-flow{
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  justify-content:center;
  align-content:flex-start;
  gap:28px 24px;
  width:100%;
  max-width:min(100%,var(--preview-flow-max,100%));
  min-width:0;
  margin:0 auto;
  box-sizing:border-box;
}
.preview-content-item{
  display:flex;
  align-items:flex-start;
  justify-content:center;
  gap:0;
  flex:0 0 auto;
  width:max-content;
  max-width:100%;
}
.preview-content-item.preview-spread .preview-page-card + .preview-page-card{
  margin-left:0!important;
}
.preview-content-item.preview-spread .preview-page-card:first-child .preview-page-viewport{
  box-shadow:1px 0 0 rgba(0,0,0,.10);
  z-index:2;
}

/* Bei maximalem Zoom wird nur eine einzelne Seite pro Reihe gezeigt. */
.preview-content-flow.single-pages{
  flex-direction:column;
  flex-wrap:nowrap;
  align-items:center;
}
.preview-content-flow.single-pages .preview-content-item{
  width:max-content;
}

/* Das gesamte Vorschau-Layout darf niemals breiter als der Modalinhalt werden. */
.publication-preview-host,
.preview-continuous-strip,
.preview-content-flow{
  box-sizing:border-box;
}

@media(max-width:900px){
  .publication-preview-host{
    padding:24px 12px 60px;
  }
  .preview-content-flow{
    gap:22px 16px;
  }
}


/* Version 15.7 – Drag & Drop in der Vorschau */
.preview-page-card[draggable="true"]{
  cursor:grab;
}
.preview-page-card.preview-dragging{
  opacity:.42;
  cursor:grabbing;
}
.preview-drop-marker{
  flex:0 0 4px;
  width:4px;
  align-self:stretch;
  min-height:80px;
  background:#2b7cff;
  border-radius:3px;
  margin:0 3px;
  box-shadow:0 0 0 1px rgba(255,255,255,.85),0 0 0 2px rgba(43,124,255,.25);
}
.preview-page-card.preview-drop-before{
  box-shadow:-4px 0 0 #2b7cff;
}
.preview-page-card.preview-drop-after{
  box-shadow:4px 0 0 #2b7cff;
}
.publication-preview-dialog .preview-page-card{
  pointer-events:auto!important;
}
.publication-preview-dialog .preview-page-viewport{
  pointer-events:none!important;
}


/* Version 16 – frei einstellbare Eckenrundung */
#cornerRadiusControls .row button{
  flex:1 1 0;
}


/* Version 16.1 – echte Seitenvorschau in den Miniaturen */
.thumb-preview{
  position:relative;
  overflow:hidden;
  background:#fff;
  border:1px solid #cfd6de;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
}
.thumb-preview-page{
  position:absolute;
  left:0;
  top:0;
  transform-origin:top left;
  pointer-events:none!important;
  overflow:hidden;
  background:#fff;
}
.thumb-preview-page .item,
.thumb-preview-page .content{
  pointer-events:none!important;
}
.thumb-preview-page .resize-handle,
.thumb-preview-page .rotate-handle,
.thumb-preview-page .rotation-angle-badge,
.thumb-preview-page .move-grip,
.thumb-preview-page .flow-badge,
.thumb-preview-page .group-badge,
.thumb-preview-page .layout-grid,
.thumb-preview-page .guides,
.thumb-preview-page .margin-guide,
.thumb-preview-page .bleed-zone,
.thumb-preview-page .trim-outline{
  display:none!important;
}
.thumb-preview-page .item.selected,
.thumb-preview-page .item.multi-selected,
.thumb-preview-page .item.editing{
  outline:none!important;
}
.thumb-preview-page [contenteditable="true"]{
  outline:none!important;
}


/* Version 16.2 – Miniaturen strikt passiv */
.thumb-preview-page .item[data-thumbnail-preview="true"]{
  pointer-events:none!important;
  user-select:none!important;
}


/* Version 17 – zentrale Server-Bildergalerie */
.image-gallery-dialog{
  width:min(94vw,1180px);
  max-width:none;
  padding:0;
  border:0;
  border-radius:12px;
}
.image-gallery-dialog::backdrop{
  background:rgba(18,23,29,.72);
}
.image-gallery-card{
  width:100%;
  max-width:none;
  max-height:90vh;
}
.gallery-toolbar{
  display:grid;
  grid-template-columns:minmax(220px,1fr) 220px auto;
  gap:8px;
  padding:12px 14px 0;
}
.gallery-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(150px,1fr));
  gap:12px;
  padding:14px;
  min-height:240px;
  max-height:58vh;
  overflow:auto;
}
.gallery-card{
  border:1px solid #d6dde4;
  border-radius:9px;
  overflow:hidden;
  background:#fff;
  cursor:pointer;
  transition:border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.gallery-card:hover{
  border-color:#9aa8b6;
  transform:translateY(-1px);
}
.gallery-card.selected{
  border-color:#2b7cff;
  box-shadow:0 0 0 2px rgba(43,124,255,.18);
}
.gallery-thumb{
  display:block;
  width:100%;
  aspect-ratio:4/3;
  object-fit:cover;
  background:#eef1f4;
}
.gallery-card-body{
  padding:7px 8px 8px;
}
.gallery-title{
  font-size:12px;
  font-weight:700;
  color:#26313d;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.gallery-meta{
  margin-top:3px;
  font-size:10px;
  color:#73808d;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.gallery-empty{
  grid-column:1/-1;
  padding:28px;
  text-align:center;
  color:#75818d;
  border:1px dashed #c7d0d9;
  border-radius:10px;
}
@media(max-width:720px){
  .gallery-toolbar{
    grid-template-columns:1fr;
  }
}


/* Version 17.2 – Rahmen im Editor und beim Druck immer hinter dem Inhalt */
.frame-overlay{
  z-index:1!important;
  background:transparent!important;
}
.item>.content{
  position:relative;
  z-index:2!important;
}
@media print{
  .frame-overlay{z-index:1!important}
  .item>.content{z-index:2!important}
}


/* Version 17.3 – Performance */
.thumb{
  content-visibility:auto;
  contain-intrinsic-size:140px 190px;
}
.thumb-preview.thumb-preview-pending{
  display:flex;
  align-items:center;
  justify-content:center;
  color:#9aa5b1;
  font-size:10px;
  background:
    linear-gradient(135deg,#f7f8fa 25%,#f1f3f6 25%,#f1f3f6 50%,#f7f8fa 50%,#f7f8fa 75%,#f1f3f6 75%);
  background-size:12px 12px;
}


/* Version 17.4 – bewusst einfache Seiten-Thumbnails */
.thumb-preview{
  position:relative;
  display:flex!important;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  background:#fff!important;
  border:1px solid #cfd6de;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
}
.thumb-page-number{
  font-size:42px;
  line-height:1;
  font-weight:800;
  color:#20800d;
  letter-spacing:-1px;
  user-select:none;
  pointer-events:none;
}
.thumb.active .thumb-page-number{
  color:#20800d;
}


/* Version 17.8 – virtuelle Leerseiten nur in der Vorschau */
.preview-page-card.preview-virtual-blank{
  opacity:.88;
}
.preview-page-card.preview-virtual-blank .preview-page-viewport{
  outline:2px dashed rgba(105,118,132,.45);
  outline-offset:-2px;
  background:#fff;
}
.preview-page-card.preview-virtual-blank .preview-page-label{
  color:#7b8793;
  font-style:italic;
}
.preview-page-card.preview-virtual-blank[draggable="false"]{
  cursor:default;
}


/* Version 17.9 – Bilder + PDF-Hintergründe in der gemeinsamen Galerie */
.gallery-toolbar{
  grid-template-columns:minmax(220px,1fr) 150px 220px auto;
}
.gallery-thumb-wrap{
  position:relative;
  width:100%;
  aspect-ratio:4/3;
  overflow:hidden;
  background:#eef1f4;
}
.gallery-thumb-wrap .gallery-thumb{
  width:100%;
  height:100%;
  aspect-ratio:auto;
}
.gallery-pdf-placeholder{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:5px;
  color:#6d7884;
  font-size:11px;
  text-align:center;
  background:linear-gradient(145deg,#f5f7f9,#e7ebef);
}
.gallery-pdf-placeholder strong{
  font-size:20px;
  letter-spacing:.5px;
}
.gallery-kind-badge{
  display:inline-block;
  margin-top:5px;
  padding:2px 6px;
  border-radius:999px;
  font-size:9px;
  font-weight:700;
  background:#edf2f7;
  color:#536170;
}
.gallery-card.background .gallery-kind-badge{
  background:#e9f2ff;
  color:#1768c5;
}
@media(max-width:850px){
  .gallery-toolbar{grid-template-columns:1fr 1fr}
}
@media(max-width:560px){
  .gallery-toolbar{grid-template-columns:1fr}
}


/* Version 18.0 – separater Hintergrund-Dialogmodus */
.gallery-toolbar{
  grid-template-columns:minmax(220px,1fr) 220px auto;
}
.image-gallery-card .dialog-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.image-gallery-card .dialog-actions .row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
@media(max-width:850px){
  .gallery-toolbar{grid-template-columns:1fr 1fr}
}
@media(max-width:560px){
  .gallery-toolbar{grid-template-columns:1fr}
  .image-gallery-card .dialog-actions{
    flex-direction:column;
    align-items:stretch;
  }
  .image-gallery-card .dialog-actions .row{
    width:100%;
    justify-content:stretch;
  }
}


/* Version 18.3 – reduzierte Eigenschaften und Schieberegler */
.property-range-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) 58px;
  align-items:center;
  gap:10px;
  margin-top:5px;
}
.properties .property-range-row input[type="range"]{
  width:100%;
  margin:0;
}
.range-value{
  display:inline-flex;
  align-items:center;
  justify-content:flex-end;
  min-width:58px;
  font-size:11px;
  font-variant-numeric:tabular-nums;
  color:#4f5965;
  white-space:nowrap;
}


/* Version 18.4 – TAB innerhalb von Textblöcken */
.item.text .content{
  tab-size:4;
  -moz-tab-size:4;
}


/* Version 19.1 – Seitenhintergrund darf durch Auswahl niemals nach vorn springen */
.page .item.page-background,
.page .item.page-background.selected,
.page .item.page-background.multi-selected{
  z-index:0!important;
}


/* Version 19.2 – kompakte Werkzeug-Popupmenüs */
.pages-panel{
  overflow:hidden;
  min-height:0;
}
.left-tools{
  flex:0 0 auto;
  padding:8px 9px 8px;
}
.left-tools-title{
  font-size:12px;
  margin:0 2px 6px;
}
.tool-popup-stack{
  display:flex;
  flex-direction:column;
  gap:5px;
}
.tool-popup-label{
  display:block;
  width:100%;
  margin:0;
}
.tool-popup{
  width:100%;
  min-width:0;
  height:30px;
  margin:0;
  padding:4px 24px 4px 7px;
  font-size:11px;
  border:1px solid #ccd4dd;
  border-radius:6px;
  background:#fff;
}
.tool-popup:focus{
  outline:2px solid rgba(18,97,216,.18);
  border-color:#7da6df;
}
.legacy-tool-actions{
  display:none!important;
}
.pages-section{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  padding:9px 10px 12px;
}
.pages-section .panel-head{
  position:sticky;
  top:0;
  z-index:20;
  padding:3px 0 7px;
  margin:0 0 7px;
  background:var(--panel);
}
.page-thumbs{
  gap:9px;
}

/* Alte aufklappbare Werkzeuggruppen werden ab V19.2 nicht mehr verwendet. */
.tool-menu-group{
  display:none!important;
}


/* Version 19.3 – direkte Ausgabeaktionen in der Kopfzeile */
.topbar{
  justify-content:space-between;
}
.topbar-actions{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:auto;
}
.topbar .topbar-action{
  min-width:104px;
  padding:7px 12px;
  border-color:#58616c;
  background:#30363e;
  color:#fff;
}
.topbar .topbar-action:hover{
  background:#3a424c;
}
.topbar .topbar-action.primary{
  background:var(--accent);
  border-color:var(--accent);
}
.topbar .topbar-action.primary:hover{
  background:var(--accent2);
}

@media(max-width:700px){
  .topbar .topbar-action{
    min-width:auto;
    padding:7px 9px;
    font-size:11px;
  }
}


/* Version 19.7 – feste Kopfzeilen in Einfüge-Dialogen */
.insert-dialog-card{
  display:flex;
  flex-direction:column;
  max-height:90vh;
  overflow:hidden;
}
.insert-dialog-head{
  position:sticky;
  top:0;
  z-index:30;
  flex:0 0 auto;
  background:#fff;
  box-shadow:0 1px 0 var(--line);
}
.insert-dialog-title{
  min-width:0;
}
.insert-dialog-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex:0 0 auto;
}
.insert-dialog-actions button{
  font-size:12px!important;
  min-width:92px;
  padding:7px 11px;
}
.insert-selection-text{
  margin-top:4px;
  color:#6d7884;
}
.insert-dialog-scroll-body{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
}

/* PDF-Seitenauswahl scrollt nur im Inhaltsbereich. */
.pdf-place-dialog.insert-dialog-card{
  width:min(980px,96vw);
  height:min(88vh,820px);
}
.pdf-place-dialog .insert-dialog-scroll-body{
  padding:18px;
}

/* Bild / Grafik / Hintergrund: Kopfzeile bleibt fest, nur Galerie scrollt. */
.image-gallery-card.insert-dialog-card{
  height:min(90vh,860px);
}
.image-gallery-card .gallery-toolbar,
.image-gallery-card > #galleryStatus{
  flex:0 0 auto;
}
.image-gallery-card #galleryStatus{
  margin:10px 14px 0;
}
.image-gallery-card .gallery-grid{
  flex:1 1 auto;
  min-height:0;
  max-height:none;
  overflow-y:auto;
}

/* Alte untere Aktionsleiste wird in diesen Einfüge-Dialogen nicht mehr benötigt. */
.image-gallery-card > .dialog-actions,
.pdf-place-dialog > .dialog-actions{
  display:none!important;
}

@media(max-width:700px){
  .insert-dialog-head{
    align-items:flex-start;
    gap:10px;
  }
  .insert-dialog-actions{
    flex-wrap:wrap;
  }
  .insert-dialog-actions button{
    min-width:auto;
  }
}


/* Version 19.8 – Einfüge-Dialoge vollständig innerhalb der Fensterbreite */
#pdfPlaceDialog,
.image-gallery-dialog{
  box-sizing:border-box;
  width:min(1180px,calc(100vw - 32px));
  max-width:calc(100vw - 32px);
  overflow:hidden;
}

#pdfPlaceDialog{
  width:min(980px,calc(100vw - 32px));
  max-width:calc(100vw - 32px);
}

#pdfPlaceDialog .pdf-place-dialog,
.image-gallery-dialog .image-gallery-card{
  box-sizing:border-box;
  width:100%;
  max-width:100%;
  min-width:0;
  overflow-x:hidden;
}

/* Keine innere horizontale Scrollfläche. */
.pdf-place-dialog .insert-dialog-scroll-body,
.image-gallery-card .gallery-grid{
  overflow-x:hidden!important;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
}

/* Kartenraster darf nie breiter als der Inhaltsbereich werden. */
.pdf-page-grid{
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  grid-template-columns:repeat(auto-fill,minmax(min(125px,100%),1fr));
}
.gallery-grid{
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  grid-template-columns:repeat(auto-fill,minmax(min(150px,100%),1fr));
}
.pdf-page-card,
.gallery-card{
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
}

/* Suche / Kategorie / Aktualisieren passt sich an die verfügbare Breite an. */
.image-gallery-card .gallery-toolbar{
  box-sizing:border-box;
  width:100%;
  max-width:100%;
  min-width:0;
  grid-template-columns:minmax(0,1fr) minmax(140px,220px) auto;
}
.image-gallery-card .gallery-toolbar > *{
  min-width:0;
  max-width:100%;
}

/* Auch die fixe Kopfzeile darf keine Überbreite erzeugen. */
.insert-dialog-head{
  box-sizing:border-box;
  width:100%;
  max-width:100%;
  min-width:0;
}
.insert-dialog-title{
  flex:1 1 auto;
  min-width:0;
}
.insert-dialog-title h2,
.insert-dialog-title .micro{
  overflow-wrap:anywhere;
}
.insert-dialog-actions{
  max-width:100%;
}

@media(max-width:720px){
  #pdfPlaceDialog,
  .image-gallery-dialog{
    width:calc(100vw - 16px);
    max-width:calc(100vw - 16px);
  }

  .image-gallery-card .gallery-toolbar{
    grid-template-columns:minmax(0,1fr) auto;
  }
  .image-gallery-card .gallery-toolbar #gallerySearch{
    grid-column:1 / -1;
  }

  .insert-dialog-head{
    flex-wrap:wrap;
  }
  .insert-dialog-actions{
    width:100%;
    justify-content:flex-end;
  }
}

@media(max-width:480px){
  .image-gallery-card .gallery-toolbar{
    grid-template-columns:1fr;
  }
  .image-gallery-card .gallery-toolbar #gallerySearch,
  .image-gallery-card .gallery-toolbar #galleryCategory,
  .image-gallery-card .gallery-toolbar #galleryRefreshBtn{
    grid-column:1;
    width:100%;
  }

  .insert-dialog-actions{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .insert-dialog-actions button{
    width:100%;
    min-width:0;
  }
  #galleryRemoveBackgroundBtn:not([hidden]){
    grid-column:1 / -1;
  }
}


/* Version 19.9 – PDF als gesperrte Dokumentbasis */
.page .item.imported-pdf-base,
.page .item.imported-pdf-base.selected,
.page .item.imported-pdf-base.multi-selected{
  z-index:0!important;
  pointer-events:none!important;
}
.pdf-document-warning-card{
  width:min(620px,calc(100vw - 32px));
  max-width:calc(100vw - 32px);
}
.pdf-document-warning-icon{
  font-size:34px;
  line-height:1;
  margin-bottom:10px;
}
.pdf-document-progress-card{
  width:min(560px,calc(100vw - 32px));
  max-width:calc(100vw - 32px);
}
.pdf-document-progress-card progress{
  width:100%;
  height:18px;
  margin-top:12px;
}


/* Version 20.0 – globale Regel: kein Modal/Meldefenster darf horizontal scrollen */
dialog{
  box-sizing:border-box;
  max-width:calc(100vw - 24px)!important;
  overflow-x:hidden!important;
}

/* Jeder Dialog-Container bleibt vollständig innerhalb des sichtbaren Fensters. */
dialog > .dialog-card,
dialog form.dialog-card,
dialog .dialog-card{
  box-sizing:border-box;
  width:min(100%,var(--dialog-preferred-width,100%));
  max-width:100%!important;
  min-width:0!important;
  overflow-x:hidden!important;
}

/* Kopf, Inhalt, Aktionen und Werkzeugzeilen dürfen keine Überbreite erzeugen. */
dialog .dialog-head,
dialog .dialog-body,
dialog .dialog-actions,
dialog .gallery-toolbar,
dialog .row,
dialog .toolbar-row,
dialog .form-row,
dialog .panel-row{
  box-sizing:border-box;
  max-width:100%;
  min-width:0;
}

/* Flex-/Grid-Kinder dürfen schrumpfen statt den Dialog zu verbreitern. */
dialog .dialog-head > *,
dialog .dialog-body > *,
dialog .dialog-actions > *,
dialog .gallery-toolbar > *,
dialog .row > *,
dialog .toolbar-row > *,
dialog .form-row > *,
dialog .panel-row > *{
  min-width:0;
  max-width:100%;
}

/* Lange Meldungen, Dateinamen, URLs und technische Texte umbrechen. */
dialog p,
dialog .micro,
dialog .info-box,
dialog .warning,
dialog .error,
dialog .status,
dialog label,
dialog h1,
dialog h2,
dialog h3,
dialog td,
dialog th,
dialog li{
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* Formularelemente niemals breiter als der verfügbare Dialogbereich. */
dialog input,
dialog select,
dialog textarea,
dialog button{
  box-sizing:border-box;
  max-width:100%;
}
dialog textarea{
  width:100%;
}

/* Tabellen bleiben im Modal und brechen notfalls Inhalte um. */
dialog table{
  width:100%;
  max-width:100%;
  table-layout:fixed;
  border-collapse:collapse;
}
dialog td,
dialog th{
  white-space:normal;
}

/* Code-/JSON-Ausgaben sollen umbrechen statt horizontal zu scrollen. */
dialog pre,
dialog code{
  max-width:100%;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* Raster innerhalb von Dialogen bleiben immer im sichtbaren Bereich. */
dialog [class*="grid"]{
  max-width:100%;
  min-width:0;
}

/* Auf kleinen Fenstern etwas mehr Sicherheitsabstand zum Rand. */
@media(max-width:700px){
  dialog{
    width:calc(100vw - 12px)!important;
    max-width:calc(100vw - 12px)!important;
  }

  dialog > .dialog-card,
  dialog form.dialog-card,
  dialog .dialog-card{
    width:100%!important;
    max-width:100%!important;
  }

  dialog .dialog-actions{
    flex-wrap:wrap;
  }
}


/* Version 20.1 – Dialog-Buttons kompakter, Beschriftungen vollständig sichtbar */
dialog button{
  font-size:11px!important;
  line-height:1.15;
  padding:6px 9px!important;
  min-height:30px;
  min-width:0!important;
  max-width:100%;
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:normal;
}

/* Buttons in Dialog-Kopfzeilen und Aktionsleisten dürfen sich flexibel verkleinern. */
dialog .dialog-actions button,
dialog .insert-dialog-actions button,
dialog .dialog-head button{
  flex:0 1 auto;
  min-width:0!important;
}

/* Mehrere Buttons in einer Reihe dürfen umbrechen, statt abgeschnitten zu werden. */
dialog .dialog-actions,
dialog .insert-dialog-actions{
  flex-wrap:wrap;
  row-gap:6px;
}

/* Primäre Aktionen bleiben gut lesbar, aber kompakt. */
dialog button.primary{
  font-weight:600;
}

/* Sehr schmale Fenster: noch etwas kompakter. */
@media(max-width:560px){
  dialog button{
    font-size:10px!important;
    padding:5px 7px!important;
    min-height:28px;
  }
}

/* Besonders lange Aktionsbeschriftungen dürfen auf zwei Zeilen gehen. */
#galleryRemoveBackgroundBtn,
#choosePdfDocumentBtn,
#placePdfPageBtn,
#saveAsTemplateBtn,
#myTemplatesBtn{
  white-space:normal!important;
  text-align:center;
}


/* Version 20.2 – einheitliche 256-Farben-CMYK-Palette */
.cmyk-color-trigger{
  width:100%;
  display:grid;
  grid-template-columns:30px minmax(0,70px) 1fr 16px;
  align-items:center;
  gap:7px;
  margin-top:5px;
  padding:5px 7px;
  min-height:38px;
  background:#fff;
  border:1px solid #cbd3dc;
  border-radius:7px;
  text-align:left;
}
.cmyk-color-trigger:hover{border-color:#8997a6;background:#f9fbfd}
.cmyk-color-trigger:focus{outline:2px solid rgba(18,97,216,.18);border-color:#7da6df}
.cmyk-color-trigger.disabled,.cmyk-color-trigger:disabled{opacity:.45;cursor:not-allowed;background:#f0f2f4}
.cmyk-color-preview{
  width:28px;height:28px;border-radius:5px;border:1px solid rgba(0,0,0,.22);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.35);
}
.cmyk-color-code{font:600 10px/1.1 ui-monospace,SFMono-Regular,Menlo,monospace;color:#303b46;white-space:nowrap}
.cmyk-color-caption{font-size:10px;color:#6d7884;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cmyk-color-arrow{font-size:11px;color:#78838f;text-align:right}

.cmyk-palette-popover{
  position:fixed;
  z-index:5000;
  width:min(356px,calc(100vw - 20px));
  max-height:calc(100vh - 20px);
  overflow-y:auto;
  overflow-x:hidden;
  box-sizing:border-box;
  background:#fff;
  border:1px solid #cbd3dc;
  border-radius:10px;
  box-shadow:0 16px 42px rgba(18,28,40,.25);
  padding:10px;
}
.cmyk-palette-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:7px}
.cmyk-palette-head b{display:block;font-size:12px;color:#2c3742}
.cmyk-palette-head span{display:block;font-size:9px;color:#78838f;margin-top:1px}
.cmyk-palette-close{border:0;background:transparent;font-size:18px;line-height:1;padding:2px 5px;color:#687582}
.cmyk-palette-current{display:flex;align-items:center;gap:7px;min-width:0;margin-bottom:8px;padding:5px 7px;background:#f5f7f9;border-radius:6px;font-size:9px;color:#66727e}
.cmyk-palette-current b{font:600 10px/1 ui-monospace,SFMono-Regular,Menlo,monospace;color:#303b46}
.cmyk-palette-current span:last-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cmyk-current-chip{flex:0 0 auto;width:18px;height:18px;border-radius:4px;border:1px solid rgba(0,0,0,.2)}
.cmyk-palette-grid{
  display:grid;
  grid-template-columns:repeat(16,minmax(10px,1fr));
  gap:2px;
  width:100%;
}
.cmyk-palette-swatch{
  aspect-ratio:1;
  width:100%;
  min-width:0;
  padding:0;
  border:1px solid rgba(0,0,0,.16);
  border-radius:2px;
  cursor:pointer;
  box-shadow:none;
}
.cmyk-palette-swatch:hover{position:relative;z-index:2;transform:scale(1.18);outline:1px solid #202832}
.cmyk-palette-swatch.selected{outline:2px solid #1261d8;outline-offset:1px;position:relative;z-index:3}
.cmyk-palette-note{font-size:8.5px;line-height:1.35;color:#7b8793;margin-top:8px}

@media(max-width:420px){
  .cmyk-palette-popover{padding:8px;width:calc(100vw - 12px)}
  .cmyk-palette-grid{gap:1px}
  .cmyk-color-trigger{grid-template-columns:28px 64px 1fr 12px;gap:5px}
}


/* Version 20.3 – kompakter Eigenschaftenbereich und Hilfe per Tooltip */
.property-help{
  cursor:help;
  text-decoration-line:underline;
  text-decoration-style:dotted;
  text-decoration-color:#a8b1bb;
  text-underline-offset:3px;
}
.property-help:hover{
  text-decoration-color:#536474;
}

.property-tooltip{
  position:fixed;
  z-index:12000;
  width:max-content;
  max-width:285px;
  padding:8px 10px;
  border-radius:7px;
  background:#202832;
  color:#fff;
  font-size:11px;
  line-height:1.35;
  box-shadow:0 8px 24px rgba(0,0,0,.24);
  pointer-events:none;
  white-space:normal;
  overflow-wrap:anywhere;
}

.text-format-group{
  margin:8px 0 10px;
}
.property-group-label,
.property-subsection-title{
  font-size:12px;
  font-weight:600;
  margin:0 0 5px;
  color:#343f4a;
}
.text-style-row,
.text-align-row{
  margin:0;
}
.text-style-row button,
.text-align-row button{
  min-width:38px;
  padding:6px 9px;
}
.text-secondary-settings{
  margin-top:10px;
}
.text-font-service{
  margin-top:14px;
  padding-top:12px;
  border-top:1px solid var(--line);
}
.text-font-service .property-subsection-title{
  margin-bottom:8px;
}

/* Hilfetexte im Eigenschaftenbereich werden ab V20.3 nicht mehr als eigene Zeilen gezeigt. */
.properties .rich-hint{
  display:none!important;
}


/* Version 20.4 – Eigene Schriften */
.font-picker-section{
  position:sticky;
  top:-5px;
  z-index:2;
  margin:0 0 3px;
  padding:7px 8px 5px;
  background:#f3f5f7;
  color:#5e6975;
  border-radius:5px;
  font:700 10px/1.2 system-ui,sans-serif;
  letter-spacing:.02em;
  text-transform:uppercase;
}
.font-picker-option + .font-picker-section{
  margin-top:6px;
}
.font-service-google-title{
  margin-top:13px!important;
  padding-top:10px;
  border-top:1px solid var(--line);
}
#customFontStatus.error{
  color:#b42318;
}


/* Version 20.5 – Status der kuratierten Google-Fonts-Auswahl */
#googleFontConfigStatus{
  margin:5px 0 7px;
}


/* Version 20.7 – Auswahl zeigt immer die echte Ebenenposition.
   Der blaue Auswahlrahmen bleibt sichtbar, ohne das Objekt künstlich nach vorn zu holen. */
.page .item.selected:not(.page-background):not(.imported-pdf-base){
  /* absichtlich kein z-index override */
}


/* Version 20.8 – sichtbare Warnung bei Textüberlauf */
.item.text.text-overflow{
  box-shadow:inset 0 0 0 1.5px rgba(194,43,58,.9);
}
.text-overflow-badge{
  position:absolute;
  right:2px;
  bottom:2px;
  z-index:30;
  padding:2px 5px;
  border-radius:4px;
  background:#c52b3a;
  color:#fff;
  font-size:8px;
  font-weight:700;
  line-height:1.15;
  pointer-events:none;
  box-shadow:0 1px 4px rgba(0,0,0,.2);
}
.text-overflow-status{
  margin:0 0 10px;
  padding:7px 8px;
  border:1px solid #e6a4ac;
  border-radius:6px;
  background:#fff1f3;
  color:#a51f2e;
  font-size:11px;
  font-weight:600;
  line-height:1.3;
}
.text-overflow-measure{
  overflow:hidden;
}

/* Warnhinweise sind reine Editorhilfen. */
.publication-preview-dialog .text-overflow-badge,
.thumb-preview-page .text-overflow-badge{
  display:none!important;
}
.publication-preview-dialog .item.text.text-overflow,
.thumb-preview-page .item.text.text-overflow{
  box-shadow:none!important;
}
@media print{
  .text-overflow-badge{display:none!important}
  .item.text.text-overflow{box-shadow:none!important}
}


/* Version 20.9 – Formatwechsel-Warnung */
.format-change-warning-card{
  width:min(650px,calc(100vw - 24px));
  max-width:100%;
}
.format-change-warning-icon{
  font-size:34px;
  line-height:1;
  margin-bottom:10px;
  color:#b16a00;
}

/* Broschürenfehler im Preflight besonders klar hervorheben. */
#preflightResults .checkline.bad{
  color:#bb2d3b;
  font-weight:600;
}


/* Version 21.0 – Hauptfarbe Grün */
:root{
  --accent:#20800d;
  --accent-hover:#196b0a;
  --accent-active:#145708;
}

/* Primäre und aktive Buttons */
button.primary,
.topbar-action.primary,
button.active,
.segmented button.active,
.toolbar button.active{
  background:#20800d!important;
  border-color:#20800d!important;
  color:#fff!important;
}

button.primary:hover,
.topbar-action.primary:hover,
button.active:hover,
.segmented button.active:hover,
.toolbar button.active:hover{
  background:#196b0a!important;
  border-color:#196b0a!important;
}

button.primary:active,
.topbar-action.primary:active,
button.active:active,
.segmented button.active:active,
.toolbar button.active:active{
  background:#145708!important;
  border-color:#145708!important;
}

/* Schieberegler */
input[type="range"]{
  accent-color:#20800d!important;
}

input[type="range"]::-webkit-slider-thumb{
  background:#20800d!important;
  border-color:#20800d!important;
}
input[type="range"]::-moz-range-thumb{
  background:#20800d!important;
  border-color:#20800d!important;
}

/* Fokus-/Auswahlfarbe ebenfalls an Hauptfarbe anpassen */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  outline-color:#20800d;
}


/* Version 21.1 – Range: grüner aktiver Teil, grauer Restbalken */
input[type="range"]{
  accent-color:#20800d!important;
}

/* Chromium / Safari: native accent-color zeichnet den aktiven Bereich grün
   und lässt den restlichen Track grau. Keine eigene Track-Füllung erzwingen. */
input[type="range"]::-webkit-slider-runnable-track{
  background:initial;
}

/* Firefox: aktiver Bereich grün, Restbereich grau. */
input[type="range"]::-moz-range-progress{
  background:#20800d!important;
}
input[type="range"]::-moz-range-track{
  background:#c9ced3!important;
}

/* Reglerknopf bleibt grün. */
input[type="range"]::-webkit-slider-thumb{
  background:#20800d!important;
  border-color:#20800d!important;
}
input[type="range"]::-moz-range-thumb{
  background:#20800d!important;
  border-color:#20800d!important;
}


/* Version 21.2 – Logo statt ZD */
.brand-logo{
  box-shadow:0 0 0 1px rgba(255,255,255,.08);
}


/* Version 21.3 – lokale persönliche Vorlagendateien */
.local-template-dialog{
  width:min(760px,calc(100vw - 24px));
  max-width:100%;
}
.local-template-layout{
  display:grid;
  grid-template-columns:minmax(150px,220px) minmax(0,1fr);
  gap:18px;
  align-items:start;
}
.local-template-preview{
  min-height:210px;
  display:grid;
  place-items:center;
  padding:10px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#f4f6f7;
  overflow:hidden;
}
.local-template-preview .template-card-preview{
  width:100%;
  min-height:190px;
  display:grid;
  place-items:center;
}
.local-template-info{
  min-width:0;
}
.local-template-info h3{
  margin:0 0 8px;
}
.local-template-description{
  margin:10px 0;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
@media(max-width:620px){
  .local-template-layout{
    grid-template-columns:1fr;
  }
}


/* Version 21.4 – Seitenmitte und dynamische Ausrichtungshilfen */
.alignment-guide-layer{
  z-index:880;
}

.center-guide,
.snap-guide{
  position:absolute;
  pointer-events:none;
  box-sizing:border-box;
}

.center-guide-v{
  top:0;
  bottom:0;
  left:50%;
  border-left:1px dashed rgba(32,128,13,.40);
}

.center-guide-h{
  left:0;
  right:0;
  top:50%;
  border-top:1px dashed rgba(32,128,13,.40);
}

.snap-guide-v{
  top:0;
  bottom:0;
  border-left:1px solid #20800d;
}

.snap-guide-h{
  left:0;
  right:0;
  border-top:1px solid #20800d;
}

.snap-guide[hidden]{
  display:none!important;
}

.publication-preview-dialog .alignment-guide-layer,
.thumb-preview-page .alignment-guide-layer{
  display:none!important;
}

@media print{
  .alignment-guide-layer{
    display:none!important;
  }
}


/* Version 21.5 – Systemvorlagen vom Webserver */
.system-template-library-dialog{
  width:min(1120px,calc(100vw - 24px));
  max-width:100%;
}
.system-template-grid{
  margin-top:14px;
}
.system-template-card{
  cursor:default;
}
.system-template-card-preview{
  flex-direction:column;
  gap:8px;
  background:
    linear-gradient(135deg,rgba(32,128,13,.06),rgba(32,128,13,.015)),
    #eef2f3;
}
.system-template-file-icon{
  width:68px;
  height:82px;
  display:grid;
  place-items:center;
  border:1px solid #b8c1c8;
  border-radius:7px;
  background:#fff;
  color:#20800d;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
  font-size:18px;
  font-weight:800;
  letter-spacing:.06em;
  position:relative;
}
.system-template-file-icon::after{
  content:"";
  position:absolute;
  right:-1px;
  top:-1px;
  width:18px;
  height:18px;
  background:
    linear-gradient(225deg,#eef2f3 50%,#fff 51%);
  border-top-right-radius:6px;
}
.system-template-kind{
  font-size:11px;
  font-weight:650;
  color:#5b6670;
}
.system-template-empty{
  grid-column:1/-1;
  padding:24px;
  text-align:center;
  border:1px dashed var(--line);
  border-radius:8px;
  color:#68717c;
  background:#f7f8f9;
}


/* Version 21.6 – Warnung beim Verlassen des Designers */
.leave-designer-dialog{
  width:min(610px,calc(100vw - 24px));
  max-width:100%;
}
.leave-designer-warning-icon{
  font-size:36px;
  line-height:1;
  margin-bottom:10px;
  color:#b16a00;
}


/* Version 21.7 – echte Vorschau der Systemvorlagen */
.system-template-card-preview{
  position:relative;
  overflow:hidden;
}

/* buildTemplatePreview liefert bereits eine maßstäbliche Mini-Seite. */
.system-template-card-preview .template-mini-page{
  max-width:100%;
  max-height:100%;
}

.system-template-preview-loading,
.system-template-preview-error{
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  text-align:center;
  color:#66727c;
  font-size:11px;
}

.system-template-preview-error{
  color:#a72c38;
}

.system-template-preview-error b{
  font-size:22px;
  line-height:1;
}

.system-template-preview-spinner{
  width:24px;
  height:24px;
  border:3px solid #cfd6da;
  border-top-color:#20800d;
  border-radius:50%;
  animation:system-template-preview-spin .8s linear infinite;
}

@keyframes system-template-preview-spin{
  to{transform:rotate(360deg)}
}


/* Version 21.8 – Hintergründe kompakt im A4-Hochformat anzeigen */
.image-gallery-dialog.gallery-mode-background .gallery-grid{
  /* Karten nicht auf die Resthöhe des Dialogs strecken. */
  align-content:start;
  align-items:start;
  grid-auto-rows:max-content;

  /* Bewusst kleine, gleichmäßige A4-Vorschauen. */
  grid-template-columns:repeat(auto-fill,minmax(138px,150px));
  justify-content:start;
  gap:14px;
}

.image-gallery-dialog.gallery-mode-background .gallery-card.background{
  width:100%;
  height:max-content;
  min-height:0;
  align-self:start;
  justify-self:stretch;
  overflow:hidden;
}

.image-gallery-dialog.gallery-mode-background .gallery-card.background .gallery-thumb-wrap{
  /* DIN A4 Hochformat: 210 × 297 mm */
  width:100%;
  aspect-ratio:210 / 297;
  height:auto;
  background:#e8ebee;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:5px;
}

.image-gallery-dialog.gallery-mode-background .gallery-card.background .gallery-thumb{
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center;
  background:#fff;
  box-shadow:0 1px 5px rgba(0,0,0,.14);
}

.image-gallery-dialog.gallery-mode-background .gallery-card.background .gallery-pdf-placeholder{
  inset:5px;
  background:#fff;
  border:1px solid #d8dde1;
}

.image-gallery-dialog.gallery-mode-background .gallery-card.background .gallery-card-body{
  flex:0 0 auto;
  padding:7px 8px 8px;
  background:#fff;
}

/* Auch bei nur einer Kartenreihe endet der Kartenrahmen direkt unter dem Inhalt. */
.image-gallery-dialog.gallery-mode-background .gallery-card.background{
  align-self:start!important;
}

/* Auf kleinen Fenstern bleiben die A4-Miniaturen kompakt. */
@media(max-width:620px){
  .image-gallery-dialog.gallery-mode-background .gallery-grid{
    grid-template-columns:repeat(auto-fill,minmax(118px,138px));
    gap:10px;
  }
}


/* ==========================================================
   Version 22.0 – PSO Coated v3 / FOGRA51 dauerhaft aktiv
   ========================================================== */

/*
  Der Browser arbeitet technisch weiterhin in RGB.
  Diese Darstellung ist eine visuelle Annäherung an den kleineren Druckfarbraum
  von PSO Coated v3 / FOGRA51.

  Keine Papierweiß-Simulation.
  Keine Bedienaktion durch den Nutzer nötig.
  Keine Änderung der eigentlichen Projekt- oder Druckdaten.
*/

/* 
  Vektor-/Textfarben aus der 256er-Palette besitzen ab Version 22.2 bereits
  individuelle FOGRA51-basierte RGB-Anzeigewerte und werden deshalb NICHT
  nochmals global gefiltert.

  Rasterbilder, platzierte PDFs und Grafiken erhalten weiterhin eine leichte
  allgemeine Softproof-Annäherung, solange im Browser keine echte ICC-Engine
  für Bildpixel verwendet wird.
*/
.canvas-host .page > .item.image .content img,
.canvas-host .page > .item.pdf .content img{
  filter:saturate(.88) contrast(.985) brightness(.992);
}

/* Editorhilfen bleiben unverändert sichtbar. */
.canvas-host .layout-grid,
.canvas-host .alignment-guide-layer,
.canvas-host .trim-outline,
.canvas-host .bleed-zone{
  filter:none!important;
}

/* Publikationsvorschau und passive Vorschauen ohne Editorfilter. */
.publication-preview-dialog .page,
.publication-preview-dialog .page > .item,
.thumb-preview-page .page,
.thumb-preview-page .page > .item{
  filter:none!important;
}

/* Druck und PDF niemals mit der Bildschirm-Simulation ausgeben. */
@media print{
  .page,
  .page > .item{
    filter:none!important;
  }
}


/* Version 22.1 – gemischte Textfarben in der Farbauswahl */
.cmyk-color-preview.mixed,
.cmyk-current-chip.mixed{
  background:
    linear-gradient(135deg,
      #111 0 25%,
      #fff 25% 50%,
      #b32635 50% 75%,
      #20800d 75% 100%)!important;
  background-size:12px 12px!important;
}
.cmyk-color-trigger .cmyk-color-code{
  overflow:hidden;
  text-overflow:ellipsis;
}


/* Version 22.2 – PSO-Coated-v3-Farbpalette */
.cmyk-palette-note{
  line-height:1.35;
}


/* Version 22.3 – Grafik-/SVG-Auswahl kompakt darstellen */
.image-gallery-dialog.gallery-mode-svg .gallery-grid{
  /* Karten nicht auf die verfügbare Modalhöhe strecken. */
  align-content:start;
  align-items:start;
  grid-auto-rows:max-content;

  /* Einheitliche kompakte Grafikvorschauen. */
  grid-template-columns:repeat(auto-fill,minmax(138px,150px));
  justify-content:start;
  gap:14px;
}

.image-gallery-dialog.gallery-mode-svg .gallery-card{
  width:100%;
  height:max-content;
  min-height:0;
  align-self:start!important;
  justify-self:stretch;
  overflow:hidden;
}

/*
  Grafiken können sehr unterschiedliche Seitenverhältnisse besitzen.
  Deshalb feste kompakte Vorschaufläche mit "contain" statt Beschnitt.
*/
.image-gallery-dialog.gallery-mode-svg .gallery-thumb-wrap{
  width:100%;
  aspect-ratio:4 / 3;
  height:auto;
  min-height:0;
  background:#eef1f4;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:8px;
}

.image-gallery-dialog.gallery-mode-svg .gallery-thumb{
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center;
  background:transparent;
}

.image-gallery-dialog.gallery-mode-svg .gallery-card-body{
  flex:0 0 auto;
  padding:7px 8px 8px;
  background:#fff;
}

/* Auch bei wenigen Grafiken endet der Rahmen direkt unter dem Karteninhalt. */
.image-gallery-dialog.gallery-mode-svg .gallery-card{
  align-self:start!important;
}

@media(max-width:620px){
  .image-gallery-dialog.gallery-mode-svg .gallery-grid{
    grid-template-columns:repeat(auto-fill,minmax(118px,138px));
    gap:10px;
  }
}


/* Version 22.6 – Bildergalerie kompakt darstellen */
.image-gallery-dialog.gallery-mode-image .gallery-grid{
  /* Karten nicht auf die verfügbare Modalhöhe strecken. */
  align-content:start;
  align-items:start;
  grid-auto-rows:max-content;

  /* Kompakte, gleichmäßige Bildvorschauen. */
  grid-template-columns:repeat(auto-fill,minmax(138px,150px));
  justify-content:start;
  gap:14px;
}

.image-gallery-dialog.gallery-mode-image .gallery-card{
  width:100%;
  height:max-content;
  min-height:0;
  align-self:start!important;
  justify-self:stretch;
  overflow:hidden;
}

.image-gallery-dialog.gallery-mode-image .gallery-thumb-wrap{
  width:100%;
  aspect-ratio:4 / 3;
  height:auto;
  min-height:0;
  background:#eef1f4;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}

.image-gallery-dialog.gallery-mode-image .gallery-thumb{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  background:#eef1f4;
}

.image-gallery-dialog.gallery-mode-image .gallery-card-body{
  flex:0 0 auto;
  padding:7px 8px 8px;
  background:#fff;
}

@media(max-width:620px){
  .image-gallery-dialog.gallery-mode-image .gallery-grid{
    grid-template-columns:repeat(auto-fill,minmax(118px,138px));
    gap:10px;
  }
}


/* Version 22.8 – Schattenparameter nur bei aktiviertem Schatten */
#shadowParameterControls{
  margin-top:2px;
}


/* Version 23.4 – Seitenname zentral über dem Layout */
.page-title-bar{
  display:flex;
  justify-content:center;
  align-items:center;
  padding:8px 50px 0;
}
.page-title-field{
  width:min(380px,100%);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  margin:0;
}
.page-title-caption{
  flex:0 0 auto;
  color:#66727e;
  font-size:11px;
  font-weight:600;
  white-space:nowrap;
}
.page-title-input{
  flex:1 1 auto;
  min-width:0;
  border:0;
  border-bottom:1px solid #c6ced7;
  border-radius:0;
  background:transparent;
  padding:4px 3px 5px;
  color:#26313d;
  font-size:12px;
  font-weight:600;
  text-align:center;
  outline:none;
}
.page-title-input:hover{
  border-bottom-color:#9ba8b5;
}
.page-title-input:focus{
  border-bottom-color:#20800d;
  box-shadow:0 1px 0 #20800d;
  background:rgba(255,255,255,.55);
}
.page-title-input.fallback{
  color:#7a8490;
  font-weight:500;
}

/* Seitennamen in den Miniaturen */
.thumb-title-text{
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:11px;
  color:#53606d;
}
.thumb-actions{
  flex:0 0 auto;
}

/* Seitennamen unter den Seiten der Publikationsvorschau */
.preview-page-label{
  max-width:100%;
  padding:0 4px;
  line-height:1.3;
  overflow-wrap:anywhere;
}

@media(max-width:700px){
  .page-title-bar{
    padding-left:16px;
    padding-right:16px;
  }
  .page-title-field{
    width:min(330px,100%);
  }
}
@media print{
  .page-title-bar{
    display:none!important;
  }
}


/* Version 23.6 – Menütitel direkt als erster Select-Eintrag */
.tool-popup option[value=""]{
  font-weight:700;
}


/* ==========================================================
   Version 24.0 – Tablet-/iPad-Modus
   Desktop ab 1200 px bleibt unverändert.
   ========================================================== */

.tablet-properties-toggle,
.tablet-properties-close,
.tablet-properties-backdrop{
  display:none;
}

@media(max-width:1199px){
  html,
  body{
    overscroll-behavior:none;
  }

  .shell{
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto minmax(0,1fr) auto;
    grid-template-areas:
      "tablet-tools"
      "tablet-workspace"
      "tablet-pages";
    height:calc(100vh - 54px);
    height:calc(100dvh - 54px);
    min-height:0;
    overflow:hidden;
  }

  /* Die bisherige linke Seitenleiste wird in ihre beiden Bestandteile
     aufgelöst: Werkzeuge oben, Seitenfilm unten. */
  .pages-panel{
    display:contents;
  }

  .left-tools{
    grid-area:tablet-tools;
    min-width:0;
    padding:8px 10px;
    border:0;
    border-bottom:1px solid var(--line);
    background:#f8fafc;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
  }

  .left-tools-title{
    display:none;
  }

  .tool-popup-stack{
    display:grid;
    grid-template-columns:repeat(5,minmax(118px,1fr));
    gap:8px;
    min-width:590px;
  }

  .tool-popup-label{
    min-width:0;
  }

  .tool-popup{
    height:42px;
    min-height:42px;
    padding:6px 28px 6px 9px;
    font-size:12px;
    touch-action:manipulation;
  }

  .workspace{
    grid-area:tablet-workspace;
    min-width:0;
    min-height:0;
    padding-right:0!important;
    overflow:auto;
    -webkit-overflow-scrolling:touch;
  }

  .workspace-bar{
    gap:9px;
    min-height:48px;
    padding:6px 10px;
  }

  .workspace-help{
    margin-left:auto;
    min-width:0;
  }

  .workspace-help .mouse-hint{
    display:none;
  }

  .workspace-status{
    max-width:180px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .tablet-properties-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:42px;
    margin-left:auto;
    border-color:#b8c3ce;
    background:#fff;
    color:#35414d;
    white-space:nowrap;
  }

  .tablet-properties-toggle.has-selection{
    border-color:#20800d;
    box-shadow:inset 0 0 0 1px rgba(32,128,13,.16);
  }

  .zoom-group button{
    min-width:42px;
    min-height:42px;
    padding:5px 9px;
  }

  .zoom-group input{
    width:110px;
  }

  .canvas-host{
    padding:26px 22px 72px;
  }

  /* Seiten als horizontaler Filmstreifen. */
  .pages-section{
    grid-area:tablet-pages;
    display:grid;
    grid-template-columns:auto minmax(0,1fr);
    align-items:stretch;
    min-width:0;
    min-height:0;
    max-height:112px;
    overflow:hidden;
    padding:7px 10px 8px;
    border-top:1px solid var(--line);
    background:#fff;
  }

  .pages-section .panel-head{
    position:static;
    z-index:auto;
    width:96px;
    min-width:96px;
    margin:0 8px 0 0;
    padding:5px 9px 5px 2px;
    border-right:1px solid #e1e6eb;
    background:transparent;
    flex-direction:column;
    justify-content:center;
    align-items:flex-start;
    gap:8px;
  }

  .pages-section .panel-head .row-tight{
    gap:6px;
  }

  .pages-section .panel-head button{
    min-width:38px;
    min-height:38px;
    padding:5px 8px;
  }

  .page-thumbs{
    display:flex;
    flex-direction:row;
    align-items:flex-start;
    gap:7px;
    min-width:0;
    overflow-x:auto;
    overflow-y:hidden;
    padding:1px 4px 5px;
    scroll-snap-type:x proximity;
    -webkit-overflow-scrolling:touch;
  }

  .page-thumbs .thumb{
    flex:0 0 62px;
    min-width:62px;
    padding:4px;
    scroll-snap-align:start;
  }

  .page-thumbs .thumb-label{
    flex-direction:column;
    align-items:stretch;
    gap:4px;
  }

  .page-thumbs .thumb-title-text{
    width:100%;
    text-align:center;
  }

  .page-thumbs .thumb-actions{
    justify-content:center;
    gap:4px;
  }

  .page-thumbs .thumb-actions button{
    min-width:28px;
    min-height:28px;
    padding:2px 6px;
    touch-action:manipulation;
  }

  /* Eigenschaften als einblendbarer Drawer von rechts. */
  .properties{
    display:block;
    position:fixed;
    top:54px;
    right:0;
    bottom:0;
    left:auto;
    width:min(360px,88vw);
    max-width:88vw;
    padding:0 15px 18px;
    border-left:1px solid var(--line);
    border-radius:0;
    background:#fff;
    overflow:auto;
    -webkit-overflow-scrolling:touch;
    z-index:970;
    box-shadow:-8px 0 28px rgba(18,25,33,.18);
    transform:translateX(105%);
    transition:transform .2s ease;
  }

  body.tablet-properties-open .properties{
    transform:translateX(0);
  }

  .tablet-properties-close{
    display:flex;
    position:sticky;
    top:0;
    z-index:30;
    width:calc(100% + 30px);
    min-height:46px;
    margin:0 -15px 12px;
    padding:9px 15px;
    align-items:center;
    gap:8px;
    border:0;
    border-bottom:1px solid var(--line);
    border-radius:0;
    background:rgba(255,255,255,.96);
    backdrop-filter:blur(8px);
    font-weight:700;
    text-align:left;
  }

  .tablet-properties-close > span{
    flex:1;
  }

  .tablet-properties-backdrop{
    display:block;
    position:fixed;
    inset:54px 0 0;
    z-index:960;
    margin:0;
    padding:0;
    border:0;
    border-radius:0;
    background:rgba(20,27,34,.28);
    opacity:0;
    pointer-events:none;
    transition:opacity .2s ease;
  }

  body.tablet-properties-open .tablet-properties-backdrop{
    opacity:1;
    pointer-events:auto;
  }

  /* Komfortablere Touch-Ziele im Eigenschaften-Drawer. */
  .properties button,
  .properties select,
  .properties input[type="number"],
  .properties input[type="text"]{
    min-height:40px;
  }

  .resize-handle{
    right:-9px;
    bottom:-9px;
    width:19px;
    height:19px;
    border-radius:4px;
    touch-action:none;
  }

  .move-grip{
    left:-8px;
    top:-8px;
    width:24px;
    height:24px;
    font-size:15px;
    line-height:22px;
    touch-action:none;
  }

  .rotate-handle{
    top:-36px;
    width:22px;
    height:22px;
    margin-left:-11px;
  }

  .rotate-handle::after{
    top:20px;
    height:16px;
  }

  .item{
    touch-action:none;
  }

  .page-stage,
  .page{
    touch-action:pan-x pan-y;
  }
}

@media(max-width:767px){
  .topbar{
    gap:8px;
    padding-left:8px;
    padding-right:8px;
  }

  .brand{
    gap:6px;
  }

  .brand small{
    display:none;
  }

  .brand-logo{
    width:28px;
    height:28px;
    flex-basis:28px;
  }

  .topbar-actions{
    gap:5px;
  }

  .topbar .topbar-action{
    min-width:0;
    padding:7px 8px;
    font-size:10.5px;
  }

  .tool-popup-stack{
    grid-template-columns:repeat(5,minmax(112px,1fr));
    min-width:560px;
    gap:6px;
  }

  .tool-popup{
    height:40px;
    min-height:40px;
    font-size:11px;
  }

  .workspace-bar{
    flex-wrap:wrap;
  }

  .zoom-group{
    flex:1 1 auto;
    min-width:250px;
  }

  .zoom-group input{
    flex:1 1 auto;
    width:auto;
    min-width:80px;
  }

  .tablet-properties-toggle{
    min-height:40px;
    font-size:11px;
  }

  .workspace-help{
    display:none;
  }

  .page-title-bar{
    padding-top:6px;
  }

  .canvas-host{
    padding:22px 14px 58px;
  }

  .pages-section{
    max-height:96px;
    padding:6px 7px 7px;
  }

  .pages-section .panel-head{
    width:82px;
    min-width:82px;
    margin-right:6px;
    padding-right:6px;
  }

  .pages-section .panel-head b{
    font-size:12px;
  }

  .pages-section .panel-head button{
    min-width:34px;
    min-height:34px;
  }

  .page-thumbs .thumb{
    flex-basis:52px;
    min-width:52px;
    padding:3px;
  }

  .page-thumbs .thumb-actions button{
    min-width:26px;
    min-height:26px;
  }

  /* Auf kleinen Displays wird der Eigenschaften-Drawer zum Bottom-Sheet. */
  .properties{
    top:auto;
    left:0;
    right:0;
    bottom:0;
    width:100%;
    max-width:none;
    max-height:72vh;
    max-height:72dvh;
    border-left:0;
    border-top:1px solid var(--line);
    border-radius:16px 16px 0 0;
    box-shadow:0 -10px 30px rgba(18,25,33,.2);
    transform:translateY(105%);
  }

  body.tablet-properties-open .properties{
    transform:translateY(0);
  }

  .tablet-properties-close{
    border-radius:16px 16px 0 0;
  }
}

@media(max-width:520px){
  .brand b{
    display:none;
  }

  .topbar .topbar-action{
    padding-left:7px;
    padding-right:7px;
  }

  .page-title-caption{
    font-size:10px;
  }

  .page-title-input{
    font-size:11px;
  }
}

@media print{
  .tablet-properties-toggle,
  .tablet-properties-close,
  .tablet-properties-backdrop{
    display:none!important;
  }
}


/* ==========================================================
   Version 24.1 – Startdialog / neues Projekt
   ========================================================== */

.startup-dialog{
  width:min(92vw,720px);
  max-width:none;
  padding:0;
  border:0;
  border-radius:16px;
  background:#fff;
}
.startup-dialog::backdrop{
  background:rgba(20,27,34,.72);
  backdrop-filter:blur(3px);
}
.startup-dialog-card{
  width:100%;
  max-width:none;
  padding:22px;
  border:1px solid #d9e0e6;
  border-radius:16px;
  background:#fff;
  box-shadow:0 22px 70px rgba(0,0,0,.28);
}
.startup-brand{
  display:flex;
  align-items:center;
  gap:13px;
  padding:0 2px 18px;
}
.startup-brand img{
  width:46px;
  height:46px;
  object-fit:contain;
}
.startup-brand h2{
  margin:0;
  font-size:22px;
  line-height:1.15;
}
.startup-brand p{
  margin:4px 0 0;
  color:#697582;
  font-size:12px;
}
.startup-step{
  min-width:0;
}
.startup-choice-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.startup-choice,
.startup-format-choice{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-start;
  min-height:132px;
  padding:18px;
  border:1px solid #d4dce4;
  border-radius:12px;
  background:#fff;
  text-align:left;
  transition:border-color .14s ease,box-shadow .14s ease,transform .14s ease;
}
.startup-choice:hover,
.startup-format-choice:hover{
  border-color:#93a2af;
  box-shadow:0 7px 22px rgba(22,31,39,.09);
  transform:translateY(-1px);
}
.startup-choice.primary-choice{
  border-color:rgba(32,128,13,.42);
  background:linear-gradient(180deg,#fff 0%,#f5fbf3 100%);
}
.startup-choice strong,
.startup-format-choice strong{
  color:#26313d;
  font-size:15px;
}
.startup-choice span{
  margin-top:7px;
  color:#697582;
  font-size:11.5px;
  line-height:1.45;
}
.startup-autosave{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-top:14px;
  padding:11px 12px;
  border:1px solid #d8e4d5;
  border-radius:10px;
  background:#f7fbf5;
}
.startup-autosave > div{
  display:flex;
  flex-direction:column;
  min-width:0;
}
.startup-autosave strong{
  color:#31412d;
  font-size:11.5px;
}
.startup-autosave span{
  margin-top:2px;
  color:#758071;
  font-size:10.5px;
}
.startup-autosave button{
  flex:0 0 auto;
  border-color:#8fb188;
  color:#2b5e21;
  white-space:nowrap;
}
.startup-step-head{
  display:flex;
  align-items:center;
  gap:13px;
  margin-bottom:14px;
}
.startup-step-head > div{
  display:flex;
  flex-direction:column;
}
.startup-step-head strong{
  font-size:15px;
}
.startup-step-head span{
  margin-top:2px;
  color:#75808b;
  font-size:11px;
}
.startup-back-btn{
  flex:0 0 auto;
}
.startup-format-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.startup-format-choice{
  align-items:center;
  min-height:190px;
  text-align:center;
}
.startup-format-choice small{
  margin-top:5px;
  color:#77818c;
  font-size:10.5px;
}
.startup-paper-icon{
  display:block;
  margin:0 auto 13px;
  border:1px solid #aeb9c4;
  border-radius:3px;
  background:#fff;
  box-shadow:0 5px 12px rgba(18,25,33,.1);
}
.startup-paper-icon.a4{
  width:70px;
  height:99px;
}
.startup-paper-icon.a5{
  width:58px;
  height:82px;
}
.startup-paper-icon.square21{
  width:82px;
  height:82px;
}
.startup-format-choice:hover .startup-paper-icon{
  border-color:#20800d;
}

@media(max-width:620px){
  .startup-dialog{
    width:calc(100vw - 18px);
  }
  .startup-dialog-card{
    padding:16px;
  }
  .startup-choice-grid,
  .startup-format-grid{
    grid-template-columns:1fr;
  }
  .startup-choice{
    min-height:104px;
  }
  .startup-format-choice{
    min-height:145px;
  }
  .startup-autosave{
    align-items:stretch;
    flex-direction:column;
  }
  .startup-autosave button{
    width:100%;
  }
}


/* Version 24.4 – deutlicher Browserhinweis im Startdialog */
.startup-browser-warning{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin:-2px 0 16px;
  padding:11px 13px;
  border:2px solid #d99200;
  border-radius:10px;
  background:#fff4d6;
  color:#4d3700;
}
.startup-browser-warning strong{
  font-size:12.5px;
  line-height:1.3;
}
.startup-browser-warning span{
  font-size:11px;
  line-height:1.45;
}


/* Version 24.5 – kompaktere Miniaturen auf kleineren Displays */
@media(max-width:1199px){
  .thumb-label{
    margin-top:5px;
    font-size:10px;
  }
  .thumb-actions button{
    font-size:9px;
    padding:2px 4px;
  }
}

@media(max-width:767px){
  .thumb-label{
    margin-top:4px;
    font-size:9.5px;
  }
  .thumb-title-text{
    font-size:10px;
  }
  .thumb-actions{
    gap:2px;
  }
  .thumb-actions button{
    font-size:9px;
    padding:1px 4px;
  }
}


/* Version 24.6 – Tablet/Kleinansicht: nur Seitennummer anzeigen */
@media(max-width:1199px){
  .page-thumbs{
    gap:6px;
    align-items:center;
  }

  .page-thumbs .thumb-label{
    display:none!important;
  }

  .page-thumbs .thumb-preview{
    margin:0 auto;
  }

  .page-thumbs .thumb-page-number{
    font-size:24px;
    color:#20800d;
    letter-spacing:0;
  }

  .page-thumbs .thumb.active .thumb-page-number{
    color:#20800d;
  }
}

@media(max-width:767px){
  .page-thumbs{
    gap:5px;
  }

  .page-thumbs .thumb-page-number{
    font-size:20px;
  }
}


/* Version 24.7 – Seitenaktionen in Tablet/Kleinansicht wieder sichtbar */
@media(max-width:1199px){
  /* Etwas mehr Höhe, damit Miniatur + Aktionszeile vollständig sichtbar sind. */
  .pages-section{
    max-height:146px;
  }

  /* Kachel bleibt kompakt, bekommt aber genug Breite für drei Aktionsbuttons. */
  .page-thumbs .thumb{
    flex-basis:104px;
    min-width:104px;
    padding:4px;
  }

  /* Seitenname bleibt verborgen, die Aktionszeile wird wieder eingeblendet. */
  .page-thumbs .thumb-label{
    display:flex!important;
    margin-top:5px;
    flex-direction:column;
    align-items:center;
    gap:0;
  }

  .page-thumbs .thumb-title-text{
    display:none!important;
  }

  .page-thumbs .thumb-actions{
    display:flex!important;
    width:100%;
    justify-content:center;
    align-items:center;
    gap:4px;
  }

  .page-thumbs .thumb-actions button{
    min-width:28px;
    width:28px;
    min-height:28px;
    height:28px;
    padding:0;
    font-size:11px;
    line-height:1;
    touch-action:manipulation;
  }
}

@media(max-width:767px){
  .pages-section{
    max-height:124px;
  }

  .page-thumbs .thumb{
    flex-basis:94px;
    min-width:94px;
    padding:3px;
  }

  .page-thumbs .thumb-label{
    margin-top:4px;
  }

  .page-thumbs .thumb-actions{
    gap:3px;
  }

  .page-thumbs .thumb-actions button{
    min-width:26px;
    width:26px;
    min-height:26px;
    height:26px;
    font-size:10px;
  }
}


/* Version 24.8 – PDF-Sicherheitswarnung */
#pdfDocumentWarningDialog .dialog-actions{
  flex-wrap:wrap;
}
#saveBeforePdfActionBtn{
  border-color:#20800d;
  color:#27651a;
}
#saveBeforePdfActionBtn:hover{
  background:#f2f8f0;
}


/* Version 24.11 – Bild-Dropdowns wie Werkzeugmenüs ohne sichtbare Beschriftung */
.properties .property-select-only{
  margin-bottom:8px;
}
.properties .property-select-only select{
  margin-top:0;
}


/* ==========================================================
   Version 25.0 – aufgeräumter Eigenschaftenbereich
   ========================================================== */

.properties .layer-action-row{
  margin:0 0 10px;
  gap:6px;
}
.properties .layer-action-row button{
  flex:1 1 0;
}

.properties .image-action-row{
  display:flex;
  flex-wrap:nowrap;
  gap:5px;
  margin-top:8px;
}
.properties .image-action-row button{
  flex:1 1 0;
  min-width:0;
  min-height:30px;
  padding:4px 5px;
  font-size:9.5px;
  line-height:1.15;
  white-space:nowrap;
}

@media(max-width:1199px){
  .properties .image-action-row button{
    min-height:32px;
    padding:4px;
    font-size:9px;
  }
}


/* Version 25.1 – kompakter Schriftbereich ohne Status-/Updateblöcke */
.properties .text-font-service{
  margin-top:10px;
}
.properties .text-font-service .font-service-google-title{
  margin-top:0;
}


/* Version 25.6 – schnelle gecachte Layoutvorlagen-Thumbnails */
.system-template-card-preview .layout-template-thumbnail-image{
  display:block;
  max-width:100%;
  max-height:100%;
  width:auto;
  height:auto;
  object-fit:contain;
  background:#fff;
  box-shadow:0 1px 6px rgba(0,0,0,.20);
}


/* Version 25.8 – Schriftauswahl über die volle rechte Eigenschaftenleiste */
.font-picker-menu{
  scrollbar-gutter:stable;
}
.font-picker-menu .font-picker-section{
  position:sticky;
  top:-5px;
  z-index:2;
  background:#f5f7f9;
}


/* Version 26.0 – Schriftwerkzeuge nur im aktiven Textbearbeitungsmodus */
#textPanel .text-edit-only.hidden{
  display:none !important;
}


/* Version 26.1 – gemischte Schriftmarkierung neutral anzeigen */
#fontPickerCurrent[data-mixed="true"]{
  font-family:system-ui,sans-serif !important;
  font-style:italic;
  color:#6f7780;
}


/* Version 26.3 – Schieberegler für die Größe der Publikationsvorschau */
.publication-preview-controls{
  flex-wrap:nowrap;
  align-items:center;
  gap:12px;
}
.preview-size-control{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:260px;
  margin:0;
  font-size:12px;
  font-weight:600;
  color:#3f4852;
}
.preview-size-caption{
  white-space:nowrap;
}
.preview-size-control input[type="range"]{
  width:170px;
  min-width:120px;
  margin:0;
}
.preview-size-value{
  min-width:78px;
  white-space:nowrap;
  text-align:right;
  font-variant-numeric:tabular-nums;
}
@media(max-width:767px){
  .publication-preview-controls{
    width:100%;
    justify-content:space-between;
  }
  .preview-size-control{
    min-width:0;
    flex:1 1 auto;
  }
  .preview-size-control input[type="range"]{
    width:auto;
    min-width:80px;
    flex:1 1 auto;
  }
  .preview-size-caption{
    display:none;
  }
}


/* Version 26.5 – Auswahl-Dialoge ohne Suchfeld */
.template-library-toolbar{
  grid-template-columns:minmax(180px,260px) auto;
  justify-content:start;
}
.image-gallery-card .gallery-toolbar{
  grid-template-columns:minmax(180px,260px) auto;
  justify-content:start;
}
@media(max-width:480px){
  .template-library-toolbar,
  .image-gallery-card .gallery-toolbar{
    grid-template-columns:1fr;
  }
  .image-gallery-card .gallery-toolbar #galleryCategory,
  .image-gallery-card .gallery-toolbar #galleryRefreshBtn{
    grid-column:1;
    width:100%;
  }
}


/* Version 26.6 – kompaktere Schriftenliste und Zeichenabstand */
#letterSpacing[data-mixed="true"] + .range-value{
  font-style:italic;
  color:#6f7780;
}


/* Version 26.7 – Ebenen per Drag & Drop umsortieren */
.layer-drag-handle{
  display:flex;
  align-items:center;
  justify-content:center;
  align-self:stretch;
  min-height:24px;
  border-radius:4px;
  color:#66717d;
  cursor:grab;
  user-select:none;
  -webkit-user-select:none;
  font-size:14px;
  line-height:1;
  letter-spacing:-3px;
}
.layer-drag-handle:hover{
  background:#edf1f5;
  color:#303840;
}
.layer-drag-handle:active{
  cursor:grabbing;
}
.layer-drag-handle.disabled{
  cursor:default;
  opacity:.28;
}
.layer-row.layer-dragging{
  opacity:.48;
}
.layer-row.layer-drop-before{
  box-shadow:inset 0 3px 0 var(--accent);
}
.layer-row.layer-drop-after{
  box-shadow:inset 0 -3px 0 var(--accent);
}
.layer-row.layer-protected .layer-name{
  opacity:.88;
}


/* Version 26.8 – Pointer-Drag für Ebenen (Firefox/Safari/Trackpad/Touch) */
.layer-drag-handle{
  touch-action:none;
  -webkit-user-drag:none;
}
body:has(.layer-row.layer-dragging){
  user-select:none;
  -webkit-user-select:none;
}


/* Version 27.1 – gemischte Schriftgröße neutral darstellen */
#fontSize[data-mixed="true"]{
  font-style:italic;
}


/* ==========================================================
   Version 27.6 – kompakter linker Seiten-/Werkzeugbereich
   Desktop: ca. 34 % schmaler als bisher (235 px -> 155 px).
   Tablet/Mobil behalten ihr eigenes Layout.
   ========================================================== */
@media(min-width:1200px){
  .shell{
    grid-template-columns:155px minmax(0,1fr) 310px;
  }

  .left-tools{
    padding:7px 6px 7px;
  }

  .left-tools-title{
    margin-left:2px;
    margin-right:2px;
    font-size:11px;
  }

  .tool-popup-stack{
    gap:4px;
  }

  .tool-popup{
    height:29px;
    padding:4px 20px 4px 6px;
    font-size:10.5px;
  }

  .pages-section{
    padding:7px 6px 9px;
  }

  .pages-section .panel-head{
    padding-bottom:5px;
    margin-bottom:5px;
  }

  .pages-section .panel-head b{
    font-size:12px;
  }

  .pages-section .panel-head .row-tight{
    gap:2px;
  }

  .pages-section .panel-head .row-tight button{
    padding:3px 5px;
    min-width:0;
  }

  .page-thumbs{
    gap:7px;
  }

  .thumb{
    padding:4px;
    border-radius:6px;
  }

  .thumb-label{
    margin-top:4px;
    gap:2px;
  }

  .thumb-title-text{
    font-size:10px;
  }

  .thumb-actions{
    gap:2px;
  }

  .thumb-actions button{
    min-width:0;
    padding:1px 3px;
    font-size:9px;
  }
}


/* ==========================================================
   Version 27.7 – isolierter Mehrseiten-Druck
   Der Browser darf beim Drucken keine Tablet-/Mobilregeln auf
   den eigentlichen Druckbereich anwenden.
   ========================================================== */

/* Auf dem Bildschirm vollständig außerhalb des sichtbaren Editors rendern,
   damit Bilder/Fonts/Layout vor dem Drucken geladen und berechnet werden. */
#zdPrintHost{
  position:fixed;
  left:-100000px;
  top:0;
  width:max-content;
  height:auto;
  visibility:hidden;
  pointer-events:none;
  z-index:-1;
}

@media print{
  html,
  body{
    width:auto!important;
    height:auto!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
    background:#fff!important;
  }

  /*
    Nur der eigens erzeugte Druckbereich wird gedruckt.
    Damit können responsive .shell/.workspace-Regeln den Druck
    nicht mehr auf die erste Seite begrenzen.
  */
  body.zd-printing > :not(#zdPrintHost){
    display:none!important;
  }

  #zdPrintHost{
    display:block!important;
    position:static!important;
    left:auto!important;
    top:auto!important;
    width:auto!important;
    height:auto!important;
    min-width:0!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
    visibility:visible!important;
    pointer-events:none!important;
    z-index:auto!important;
  }

  #zdPrintHost .page-wrap{
    display:block!important;
    position:relative!important;
    width:auto!important;
    height:auto!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
    break-before:auto!important;
    page-break-before:auto!important;
    break-after:page!important;
    page-break-after:always!important;
  }

  #zdPrintHost .page-wrap:last-child{
    break-after:auto!important;
    page-break-after:auto!important;
  }

  #zdPrintHost .page-stage{
    display:block!important;
    position:relative!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
    transform:none!important;
    box-shadow:none!important;
  }

  #zdPrintHost .page{
    display:block!important;
    position:absolute!important;
    left:0!important;
    top:0!important;
    margin:0!important;
    padding:0!important;
    transform-origin:center center;
    box-shadow:none!important;
    overflow:hidden!important;
    filter:none!important;
  }

  #zdPrintHost .page-label,
  #zdPrintHost .guides,
  #zdPrintHost .layout-grid,
  #zdPrintHost .resize-handle,
  #zdPrintHost .rotate-handle,
  #zdPrintHost .rotation-angle-badge,
  #zdPrintHost .flow-badge,
  #zdPrintHost .group-badge,
  #zdPrintHost .move-grip,
  #zdPrintHost .bleed-zone,
  #zdPrintHost .trim-outline,
  #zdPrintHost .alignment-guide-layer,
  #zdPrintHost .text-overflow-badge,
  #zdPrintHost .pdf-badge{
    display:none!important;
  }

  #zdPrintHost .item.selected,
  #zdPrintHost .item.multi-selected{
    outline:none!important;
  }

  /* Version 28.4:
     Rahmenschatten dürfen im isolierten Druckbereich nicht am
     Shadow-Overlay bzw. dessen SVG-Fläche abgeschnitten werden. */
  #zdPrintHost .shadow-overlay,
  #zdPrintHost .shadow-overlay svg{
    overflow:visible!important;
  }

  #zdPrintHost .page,
  #zdPrintHost .page > .item{
    filter:none!important;
  }

  /* Druckseiten dürfen niemals durch Bildschirm-Responsive-Regeln begrenzt werden. */
  #zdPrintHost,
  #zdPrintHost .page-wrap,
  #zdPrintHost .page-stage{
    max-width:none!important;
    max-height:none!important;
  }
}


/* ==========================================================
   Version 28.3 – schnellere Vorschau mehrseitiger Vorlagen
   ========================================================== */
.system-template-cached-thumbnail,
.system-template-server-thumbnail{
  display:block;
  max-width:100%;
  max-height:100%;
  width:auto;
  height:auto;
  object-fit:contain;
  background:#fff;
  box-shadow:0 1px 6px rgba(0,0,0,.18);
}

.system-template-quick-preview{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  height:100%;
}

.system-template-quick-page{
  position:relative;
  overflow:hidden;
  flex:0 0 auto;
  background:#fff;
  border:1px solid #d7dde2;
  box-shadow:0 1px 6px rgba(0,0,0,.16);
  padding:8px 7px;
  box-sizing:border-box;
}

.system-template-quick-mast{
  height:7px;
  width:72%;
  margin-bottom:8px;
  border-radius:2px;
  background:#65717b;
}

.system-template-quick-image{
  height:34%;
  margin-bottom:8px;
  border-radius:2px;
  background:linear-gradient(135deg,#c7ced4,#e2e6e9);
}

.system-template-quick-lines{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.system-template-quick-lines i{
  display:block;
  height:2px;
  border-radius:2px;
  background:#c6cdd2;
}

.system-template-quick-lines i:nth-child(2){width:91%}
.system-template-quick-lines i:nth-child(3){width:96%}
.system-template-quick-lines i:nth-child(4){width:78%}
.system-template-quick-lines i:nth-child(5){width:88%}

.system-template-page-count-badge{
  position:absolute;
  right:10px;
  bottom:10px;
  padding:3px 6px;
  border-radius:999px;
  background:rgba(32,128,13,.92);
  color:#fff;
  font-size:10px;
  font-weight:700;
  line-height:1;
  box-shadow:0 1px 4px rgba(0,0,0,.14);
}

.system-template-preview-warning{
  position:absolute;
  right:7px;
  top:7px;
  display:grid;
  place-items:center;
  width:22px;
  height:22px;
  border-radius:50%;
  background:#fff7e8;
  color:#a46400;
  border:1px solid #e7c88f;
  font-size:12px;
  cursor:help;
}
