*{box-sizing:border-box}body{margin:0;font-family:Arial,Helvetica,sans-serif;background:#f5f6f8;color:#222}a{color:inherit}
.topbar{height:58px;background:#202124;color:#fff;display:flex;align-items:center;gap:20px;padding:0 22px;position:sticky;top:0;z-index:30}
.topbar strong{font-size:18px;margin-right:auto}.topbar a{text-decoration:none;color:#fff}.dashboard{max-width:1250px;margin:auto;padding:30px}
.dash-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:25px}.dash-head h1{margin:0 0 5px}.dash-head p{margin:0;color:#666}
.btn,button{border:1px solid #d5d7db;border-radius:7px;background:white;padding:9px 13px;cursor:pointer;text-decoration:none;font-size:14px}.btn.primary,button.primary{background:#ef7d00;color:white;border-color:#ef7d00}.btn.danger{color:#b42318}
.project-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:20px}.project-card{background:white;border-radius:12px;padding:14px;box-shadow:0 2px 12px #00000010}
.preview{height:180px;background:#eee;border-radius:8px;display:flex;align-items:center;justify-content:center;overflow:hidden}.preview img{width:100%;height:100%;object-fit:contain}.project-card h3{margin:12px 0 5px}.project-card p{font-size:13px;color:#666}.actions{display:flex;gap:8px}
.auth{min-height:100vh;display:grid;place-items:center;background:#eee}.auth-card{width:min(420px,92vw);background:white;padding:28px;border-radius:14px;box-shadow:0 8px 35px #0002}.auth-card h1{color:#ef7d00}.auth-card label,.sidebar label{display:block;font-size:13px;margin:11px 0}.auth-card input,.sidebar input,#projectTitle{width:100%;padding:9px;border:1px solid #ccd0d5;border-radius:6px}.auth-card button{width:100%;background:#ef7d00;color:white;border:none}.alert{background:#fee4e2;padding:10px;border-radius:6px}
.editor-page{overflow:hidden}.editor-top{gap:12px}.editor-top #projectTitle{width:260px;background:#343536;border-color:#555;color:white}.top-actions{display:flex;gap:7px;margin-left:auto}.file-btn{position:relative;overflow:hidden;display:inline-flex;align-items:center;justify-content:center}.file-btn input[type=file]{position:absolute;inset:0;opacity:0;cursor:pointer}
.editor-shell{height:calc(100vh - 58px);display:grid;grid-template-columns:260px 1fr}.sidebar{background:#fff;border-right:1px solid #ddd;overflow:auto;padding:14px}.sidebar section{padding:8px 0 18px;border-bottom:1px solid #eee}.sidebar h3{font-size:14px;margin:8px 0 12px}.toolbtn{width:100%;margin:4px 0}.row{display:flex;gap:6px}.canvas-area{overflow:auto;padding:32px;display:flex;flex-direction:column;align-items:center;background:#dfe1e5}.canvas-wrap{background:white;box-shadow:0 4px 24px #0004;line-height:0}.status{margin-top:16px;background:#fff;padding:6px 12px;border-radius:20px;font-size:12px;color:#666}
.empty{background:#fff;padding:30px;border-radius:10px}
@media(max-width:900px){.editor-shell{grid-template-columns:210px 1fr}.top-actions{overflow-x:auto}.editor-top #projectTitle{width:170px}}

.editor-v2{grid-template-columns:260px minmax(0,1fr) 245px}.layers-panel{background:#fff;border-left:1px solid #ddd;overflow:auto;padding:12px}.layers-head{display:flex;justify-content:space-between;align-items:center}.layer-row{display:grid;grid-template-columns:1fr 30px 30px;gap:3px;padding:3px;border-radius:6px}.layer-row.active{background:#fff1e3}.layer-label,.layer-icon{border:0;background:transparent}.layer-label{text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.button-grid{display:grid;grid-template-columns:1fr 1fr;gap:5px}.sidebar select{width:100%;padding:9px;border:1px solid #ccd0d5;border-radius:6px}.full{width:100%}.check{display:flex!important;gap:7px;align-items:center}.check input{width:auto!important}.workspace-scroll{width:100%;height:100%;overflow:auto;display:flex;justify-content:center;align-items:flex-start;padding:15px}.view-value{text-align:center;font-size:12px;color:#666}@media(max-width:1100px){.editor-v2{grid-template-columns:220px 1fr}.layers-panel{display:none}}

.dash-buttons{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.import-project-btn{background:#fff7ed;border-color:#ef7d00;color:#b45309;font-weight:600}
.import-project-btn:hover{background:#ffedd5}

.editor-v3{grid-template-columns:280px minmax(0,1fr) 255px}
.canvas-wrap{position:relative}
#overlayGuides{position:absolute;inset:0;pointer-events:none;z-index:20}
.print-guide{position:absolute;pointer-events:none}
.bleed-guide{border:1px dashed #d92d20}
.safe-guide{border:1px dashed #12b76a}
.smart-guide{position:absolute;z-index:40;pointer-events:none}
.smart-guide.vertical{top:0;bottom:0;width:1px;background:#1570ef}
.smart-guide.horizontal{left:0;right:0;height:1px;background:#1570ef}
.layer-row.dragging{opacity:.45}
.layer-row.drag-over{border-color:#ef7d00;background:#fff7ed}
.layers-help{font-size:11px;color:#777;margin-bottom:8px}
@media(max-width:1150px){
 .editor-v3{grid-template-columns:230px minmax(0,1fr)}
 .layers-panel{display:none}
}


/* ===== V3.2 Accordion Sidebar ===== */
.sidebar-accordion{
  padding:0;
  background:#f7f7f8;
  border-right:1px solid #e5e7eb;
}
.sidebar-brand{
  padding:16px 16px 12px;
  border-bottom:1px solid #e5e7eb;
  background:#fff;
}
.sidebar-brand-title{
  font-weight:700;
  font-size:15px;
}
.sidebar-brand-sub{
  font-size:12px;
  color:#777;
  margin-top:2px;
}
.accordion{
  padding:10px;
}
.acc-section{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:10px;
  margin-bottom:9px;
  overflow:hidden;
  box-shadow:0 1px 2px rgba(0,0,0,.025);
}
.acc-section summary{
  list-style:none;
  cursor:pointer;
  display:grid;
  grid-template-columns:28px 1fr 20px;
  gap:8px;
  align-items:center;
  padding:12px 12px;
  user-select:none;
  font-size:13px;
  font-weight:650;
}
.acc-section summary::-webkit-details-marker{display:none}
.acc-section[open] summary{
  border-bottom:1px solid #f0f0f1;
  background:#fcfcfc;
}
.acc-icon{
  width:28px;
  height:28px;
  border-radius:7px;
  display:grid;
  place-items:center;
  background:#fff3e8;
  color:#d76f00;
  font-weight:700;
  font-size:14px;
}
.acc-title{min-width:0}
.acc-chevron{
  font-size:16px;
  color:#777;
  transition:transform .15s ease;
  text-align:center;
}
.acc-section[open] .acc-chevron{transform:rotate(180deg)}
.acc-content{
  padding:12px;
}
.acc-content label{
  margin:8px 0;
}
.acc-content input,
.acc-content select{
  width:100%;
}
.field-grid{
  display:grid;
  gap:8px;
}
.field-grid.two{
  grid-template-columns:1fr 1fr;
}
.stack-actions{
  display:grid;
  gap:6px;
  margin:8px 0;
}
.tool-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:8px;
}
.tool-card{
  min-height:70px;
  border:1px solid #e2e4e8;
  background:#fff;
  border-radius:9px;
  display:flex;
  flex-direction:column;
  gap:6px;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-size:12px;
  padding:9px;
}
.tool-card:hover{
  border-color:#ef7d00;
  background:#fffaf5;
}
.tool-card-icon{
  font-size:19px;
  font-weight:700;
  color:#ef7d00;
}
.segmented{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:4px;
  margin-top:8px;
}
.segmented .btn{
  padding:7px 4px;
  font-size:11px;
}
.subheading{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:#7a7f87;
  margin:12px 0 6px;
  font-weight:700;
}
.hint-box{
  background:#f6f7f9;
  border:1px solid #e3e5e8;
  color:#62676f;
  border-radius:8px;
  padding:9px 10px;
  font-size:12px;
  line-height:1.4;
  margin-bottom:8px;
}
.switch-row{
  display:flex!important;
  align-items:center;
  gap:9px;
  padding:7px 0;
  margin:0!important;
}
.switch-row input{
  width:auto!important;
  margin:0;
}
.switch-row span{
  font-size:12px;
}
.zoom-readout{
  font-size:12px;
  text-align:center;
  color:#666;
  margin-top:-4px;
  margin-bottom:6px;
}
.secondary-soft{
  background:#f5f5f6;
  border-color:#dedfe2;
}
.primary-soft{
  background:#fff3e8;
  border-color:#f3b06c;
  color:#b95800;
}
.danger-soft{
  background:#fff4f2;
  border-color:#f2c3bc;
  color:#b42318;
}
.editor-top{
  box-shadow:0 1px 0 rgba(255,255,255,.05);
}
.top-actions .btn{
  white-space:nowrap;
}
.layers-panel{
  background:#fafafa;
}
.layers-head{
  position:sticky;
  top:0;
  background:#fafafa;
  z-index:2;
  padding-top:4px;
}
.layer-row{
  background:#fff;
}
@media(max-width:900px){
  .sidebar-accordion{
    width:220px;
  }
  .field-grid.two{
    grid-template-columns:1fr;
  }
  .tool-grid{
    grid-template-columns:1fr 1fr;
  }
}


/* ===== V3.3 Themed Accordion Navigation ===== */
.sidebar-accordion{
  background:
    linear-gradient(180deg,#f4f5f7 0%,#f8f8f9 100%);
}
.sidebar-brand{
  background:linear-gradient(135deg,#ffffff 0%,#fafafa 100%);
  padding:17px 16px 14px;
}
.sidebar-brand-title{
  font-size:16px;
  font-weight:750;
  letter-spacing:-.01em;
}
.sidebar-brand-sub{
  color:#8a8f98;
  margin-top:3px;
}

.accordion{
  padding:12px 10px 18px;
}

.acc-section{
  --acc-color:#ef7d00;
  --acc-soft:#fff5eb;
  --acc-border:#f2d1ae;
  margin-bottom:12px;
  border:1px solid #e3e5e8;
  border-radius:13px;
  background:#fff;
  box-shadow:
    0 1px 2px rgba(16,24,40,.04),
    0 4px 10px rgba(16,24,40,.025);
  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    transform .18s ease;
}
.acc-section:hover{
  border-color:var(--acc-border);
  box-shadow:
    0 2px 4px rgba(16,24,40,.05),
    0 7px 18px rgba(16,24,40,.045);
}
.acc-section[open]{
  border-color:var(--acc-border);
  box-shadow:
    0 2px 5px rgba(16,24,40,.05),
    0 9px 22px rgba(16,24,40,.055);
}

.acc-section summary{
  position:relative;
  grid-template-columns:38px 1fr 24px;
  gap:10px;
  padding:11px 12px;
  min-height:58px;
  background:#fff;
  outline:none;
}
.acc-section summary:focus-visible{
  box-shadow:inset 0 0 0 2px var(--acc-color);
}
.acc-section[open] summary{
  background:
    linear-gradient(90deg,var(--acc-soft) 0%,#ffffff 70%);
  border-bottom:1px solid var(--acc-border);
}
.acc-section summary::before{
  content:"";
  position:absolute;
  left:0;
  top:11px;
  bottom:11px;
  width:4px;
  border-radius:0 4px 4px 0;
  background:var(--acc-color);
  opacity:.8;
}
.acc-section:not([open]) summary::before{
  opacity:.5;
}

.acc-icon{
  width:38px;
  height:38px;
  border-radius:10px;
  display:grid;
  place-items:center;
  background:var(--acc-soft);
  color:var(--acc-color);
  border:1px solid var(--acc-border);
  font-size:17px;
  font-weight:800;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.8);
}
.acc-title-wrap{
  display:flex;
  flex-direction:column;
  justify-content:center;
  min-width:0;
}
.acc-title{
  font-size:13px;
  font-weight:750;
  color:#2a2e34;
  line-height:1.2;
}
.acc-subtitle{
  font-size:10.5px;
  color:#8a8f98;
  font-weight:500;
  line-height:1.3;
  margin-top:3px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.acc-chevron{
  width:24px;
  height:24px;
  border-radius:7px;
  display:grid;
  place-items:center;
  background:#f4f5f6;
  color:#777d85;
  transition:
    transform .18s ease,
    background .18s ease,
    color .18s ease;
}
.acc-section[open] .acc-chevron{
  transform:rotate(180deg);
  background:var(--acc-soft);
  color:var(--acc-color);
}

.acc-content{
  padding:13px 13px 14px;
  background:#fff;
}

/* Thematic colors */
.acc-document{
  --acc-color:#d97706;
  --acc-soft:#fff7ed;
  --acc-border:#fed7aa;
}
.acc-elements{
  --acc-color:#2563eb;
  --acc-soft:#eff6ff;
  --acc-border:#bfdbfe;
}
.acc-text{
  --acc-color:#7c3aed;
  --acc-soft:#f5f3ff;
  --acc-border:#ddd6fe;
}
.acc-image{
  --acc-color:#0891b2;
  --acc-soft:#ecfeff;
  --acc-border:#a5f3fc;
}
.acc-object{
  --acc-color:#059669;
  --acc-soft:#ecfdf5;
  --acc-border:#a7f3d0;
}
.acc-view{
  --acc-color:#475569;
  --acc-soft:#f1f5f9;
  --acc-border:#cbd5e1;
}

/* Better controls within sections */
.acc-content input:not([type="checkbox"]):not([type="range"]),
.acc-content select{
  background:#fff;
  border:1px solid #d9dde3;
  transition:border-color .15s ease,box-shadow .15s ease;
}
.acc-content input:not([type="checkbox"]):not([type="range"]):focus,
.acc-content select:focus{
  outline:none;
  border-color:var(--acc-color);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--acc-color) 13%,transparent);
}
.acc-content label{
  color:#565c65;
  font-weight:600;
  font-size:11px;
}
.acc-content .btn{
  transition:
    background .15s ease,
    border-color .15s ease,
    transform .08s ease;
}
.acc-content .btn:active,
.tool-card:active{
  transform:translateY(1px);
}

.tool-card{
  position:relative;
  background:linear-gradient(180deg,#fff 0%,#fcfcfc 100%);
  border-color:#e1e4e8;
  box-shadow:0 1px 2px rgba(16,24,40,.03);
}
.tool-card:hover{
  border-color:var(--acc-color,#2563eb);
  background:var(--acc-soft,#eff6ff);
}
.acc-elements .tool-card:hover{
  border-color:#60a5fa;
  background:#eff6ff;
}
.acc-elements .tool-card-icon{
  color:#2563eb;
}

.subheading{
  border-top:1px solid #eef0f2;
  padding-top:11px;
  margin-top:13px;
}

.hint-box{
  background:linear-gradient(180deg,#f8fafc,#f5f7f9);
  border-color:#e1e5e9;
}

/* Cleaner section separation in narrow sidebar */
@media(max-width:900px){
  .accordion{padding-left:8px;padding-right:8px}
  .acc-section summary{
    grid-template-columns:34px 1fr 22px;
    padding-left:10px;
    padding-right:10px;
  }
  .acc-icon{
    width:34px;
    height:34px;
  }
  .acc-subtitle{
    font-size:10px;
  }
}


/* ===== V3.4 visible grid and stronger accordion fallback ===== */
#overlayGuides.grid-visible{
  background-position:0 0;
}
.acc-section{
  border-width:1px!important;
}
.acc-section.acc-document>summary{border-left:5px solid #d97706!important}
.acc-section.acc-elements>summary{border-left:5px solid #2563eb!important}
.acc-section.acc-text>summary{border-left:5px solid #7c3aed!important}
.acc-section.acc-image>summary{border-left:5px solid #0891b2!important}
.acc-section.acc-object>summary{border-left:5px solid #059669!important}
.acc-section.acc-view>summary{border-left:5px solid #475569!important}
.acc-section.acc-document[open]>summary{background:#fff7ed!important}
.acc-section.acc-elements[open]>summary{background:#eff6ff!important}
.acc-section.acc-text[open]>summary{background:#f5f3ff!important}
.acc-section.acc-image[open]>summary{background:#ecfeff!important}
.acc-section.acc-object[open]>summary{background:#ecfdf5!important}
.acc-section.acc-view[open]>summary{background:#f1f5f9!important}


/* ===== V3.5 Version, editable layer names, templates ===== */
.app-version,
.header-version{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:3px 7px;
  border-radius:999px;
  font-size:10px;
  font-weight:700;
  letter-spacing:.03em;
  background:#45474a;
  color:#e8eaed;
  white-space:nowrap;
}
.editor-top .app-version{
  margin-left:-8px;
}
.layer-row{
  grid-template-columns:minmax(0,1fr) 30px 30px;
}
.layer-name-wrap{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) 28px;
  align-items:center;
  gap:2px;
}
.layer-name-wrap .layer-label{
  min-width:0;
}
.layer-rename{
  opacity:.48;
  font-size:14px;
}
.layer-row:hover .layer-rename,
.layer-row.active .layer-rename{
  opacity:1;
}
.template-dialog{
  width:min(920px,92vw);
  max-height:82vh;
  border:0;
  border-radius:16px;
  padding:0;
  box-shadow:0 28px 80px rgba(0,0,0,.32);
}
.template-dialog::backdrop{
  background:rgba(20,23,28,.55);
}
.template-dialog-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  padding:18px 20px;
  border-bottom:1px solid #e7e9ec;
  background:#fafafa;
}
.template-dialog-head h3{
  margin:0 0 3px;
}
.template-dialog-head p{
  margin:0;
  font-size:12px;
  color:#70757d;
}
.template-list{
  padding:18px;
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:15px;
  overflow:auto;
  max-height:65vh;
}
.template-card{
  border:1px solid #e0e3e7;
  border-radius:12px;
  background:#fff;
  padding:10px;
  box-shadow:0 2px 8px rgba(16,24,40,.04);
}
.template-preview{
  height:150px;
  background:#f2f3f5;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  color:#8a8f98;
  font-size:12px;
}
.template-preview img{
  width:100%;
  height:100%;
  object-fit:contain;
}
.template-meta{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:10px 2px 8px;
}
.template-meta strong{
  font-size:13px;
}
.template-meta span{
  font-size:11px;
  color:#737982;
}
.template-actions{
  display:flex;
  gap:6px;
}
.template-actions .btn:first-child{
  flex:1;
}
.template-empty{
  grid-column:1/-1;
  padding:30px;
  text-align:center;
  color:#777;
  background:#f7f8f9;
  border-radius:10px;
}


/* ===== V3.5.1 robust project loading ===== */
.project-loading-overlay{
  position:fixed;
  inset:0;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(245,246,248,.94);
  backdrop-filter:blur(3px);
  transition:opacity .2s ease,visibility .2s ease;
}
.project-loading-overlay.hidden{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
}
.project-loading-card{
  min-width:280px;
  max-width:430px;
  padding:24px 28px;
  border-radius:16px;
  background:#fff;
  border:1px solid #e2e5e9;
  box-shadow:0 18px 55px rgba(16,24,40,.16);
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  gap:8px;
}
.project-loading-card strong{
  font-size:15px;
  margin-top:5px;
}
.project-loading-card span{
  font-size:12px;
  color:#737982;
  line-height:1.45;
}
.loading-spinner{
  width:34px;
  height:34px;
  border:3px solid #f1d8bd;
  border-top-color:#ef7d00;
  border-radius:50%;
  animation:raxxaSpin .75s linear infinite;
}
@keyframes raxxaSpin{to{transform:rotate(360deg)}}


/* ===== V3.6 Multi-page documents ===== */
.multi-page-area{
  min-width:0;
  align-items:stretch;
}
.pages-toolbar{
  width:100%;
  display:flex;
  gap:7px;
  align-items:center;
  position:sticky;
  top:0;
  z-index:25;
  padding:9px 12px;
  background:rgba(255,255,255,.96);
  border-bottom:1px solid #d7dbe0;
  backdrop-filter:blur(5px);
}
.pages-toolbar-info{
  margin-left:auto;
  font-size:12px;
  color:#6d737c;
  font-weight:600;
}
.multi-page-scroll{
  display:block;
  padding:28px 24px 70px;
}
.pages-container{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:42px;
}
.design-page-shell{
  display:flex;
  flex-direction:column;
  align-items:center;
  transition:opacity .15s ease;
}
.design-page-header{
  width:100%;
  display:grid;
  grid-template-columns:auto minmax(160px,1fr) auto;
  gap:10px;
  align-items:center;
  margin-bottom:8px;
  padding:0 2px;
}
.design-page-number{
  font-size:11px;
  font-weight:750;
  color:#656b74;
  background:#fff;
  border:1px solid #dfe2e6;
  border-radius:7px;
  padding:6px 8px;
}
.design-page-name{
  border:1px solid transparent;
  border-radius:7px;
  padding:6px 8px;
  background:transparent;
  font-size:12px;
  font-weight:650;
  color:#34383e;
}
.design-page-name:hover,
.design-page-name:focus{
  background:#fff;
  border-color:#d8dde3;
  outline:none;
}
.active-page-badge{
  opacity:0;
  font-size:10px;
  font-weight:750;
  color:#b85d00;
  background:#fff1df;
  border:1px solid #f4ca98;
  border-radius:999px;
  padding:4px 7px;
}
.design-page-shell.active .active-page-badge{opacity:1}
.page-canvas-wrap{
  position:relative;
  background:#fff;
  box-shadow:0 7px 28px rgba(0,0,0,.22);
  outline:3px solid transparent;
  transition:outline-color .15s ease,box-shadow .15s ease;
}
.design-page-shell.active .page-canvas-wrap{
  outline-color:#ef7d00;
  box-shadow:0 9px 34px rgba(0,0,0,.27);
}
.page-overlay-guides{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:20;
}
.export-pages-body{padding:18px}
.export-format-row{
  display:flex;
  align-items:center;
  gap:14px;
  padding:10px 12px;
  background:#f6f7f9;
  border-radius:9px;
  margin-bottom:12px;
}
.export-format-row label{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  font-weight:650;
}
.export-pages-list{
  display:grid;
  gap:7px;
  max-height:45vh;
  overflow:auto;
}
.export-page-option{
  display:flex;
  align-items:center;
  gap:9px;
  padding:10px 12px;
  border:1px solid #e0e3e7;
  border-radius:8px;
  background:#fff;
  cursor:pointer;
}
.export-page-option:hover{background:#fff8f0;border-color:#f0c08d}
.export-dialog-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  border-top:1px solid #e7e9ec;
  margin-top:14px;
  padding-top:14px;
}
@media(max-width:900px){
  .pages-toolbar{overflow-x:auto}
  .pages-toolbar .btn{white-space:nowrap}
  .multi-page-scroll{padding-left:12px;padding-right:12px}
}


/* ===== V3.7 New project wizard ===== */
.new-project-page{
  min-height:100vh;
  background:#f4f5f7;
}
.new-project-wrap{
  width:min(1120px,94vw);
  margin:0 auto;
  padding:32px 0 60px;
}
.new-project-head h1{
  margin:0 0 6px;
  font-size:28px;
}
.new-project-head p{
  margin:0;
  color:#6c727b;
}
.start-choice-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
  margin:26px 0 20px;
}
.start-choice{
  min-height:130px;
  border:2px solid #dfe3e8;
  background:#fff;
  border-radius:16px;
  padding:20px;
  display:grid;
  grid-template-columns:48px 1fr;
  grid-template-rows:auto auto;
  column-gap:14px;
  text-align:left;
  cursor:pointer;
  box-shadow:0 3px 12px rgba(16,24,40,.04);
}
.start-choice:hover{
  border-color:#efb270;
}
.start-choice.active{
  border-color:#ef7d00;
  background:linear-gradient(135deg,#fff7ed,#fff);
  box-shadow:0 8px 26px rgba(239,125,0,.12);
}
.start-choice-icon{
  grid-row:1/3;
  width:48px;
  height:48px;
  border-radius:13px;
  display:grid;
  place-items:center;
  background:#f2f4f7;
  font-size:23px;
  color:#4c5562;
}
.start-choice.active .start-choice-icon{
  background:#ef7d00;
  color:#fff;
}
.start-choice strong{
  align-self:end;
  font-size:16px;
}
.start-choice > span:last-child{
  align-self:start;
  color:#777e87;
  font-size:12px;
  margin-top:4px;
}
.new-project-panel{
  background:#fff;
  border:1px solid #e0e3e7;
  border-radius:16px;
  padding:22px;
  box-shadow:0 5px 20px rgba(16,24,40,.055);
}
.new-project-panel[hidden]{display:none}
.panel-title{
  display:flex;
  justify-content:space-between;
  margin-bottom:18px;
  border-bottom:1px solid #eceef1;
  padding-bottom:14px;
}
.panel-title h2{margin:0 0 4px;font-size:19px}
.panel-title p{margin:0;color:#787e87;font-size:12px}
.new-project-form-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:13px 16px;
  max-width:760px;
}
.new-project-form-grid .span-2{grid-column:1/-1}
.new-project-form-grid label{
  font-size:12px;
  font-weight:650;
  color:#555d67;
}
.new-project-form-grid input,
.new-project-form-grid select{
  width:100%;
  margin-top:5px;
  padding:10px 11px;
  border:1px solid #d4d9df;
  border-radius:8px;
  background:#fff;
}
.new-project-form-grid input:focus,
.new-project-form-grid select:focus{
  outline:none;
  border-color:#ef7d00;
  box-shadow:0 0 0 3px rgba(239,125,0,.11);
}
.new-project-preview{
  display:grid;
  grid-template-columns:1fr auto;
  gap:25px;
  align-items:center;
  margin-top:22px;
  padding:16px;
  border-radius:12px;
  background:#f7f8fa;
  border:1px solid #e4e7eb;
}
.new-project-preview > div:first-child{
  display:flex;
  flex-direction:column;
  gap:5px;
}
.new-project-preview span{
  font-size:12px;
  color:#777e87;
}
.np-page-preview{
  width:96px;
  height:128px;
  background:#fff;
  border:1px solid #cfd5dc;
  box-shadow:0 4px 14px rgba(0,0,0,.1);
  display:grid;
  place-items:center;
  padding:6px;
  text-align:center;
}
.np-page-preview.landscape{
  width:128px;
  height:88px;
}
.np-page-preview span{
  font-size:10px;
  color:#68707a;
}
.new-project-actions{
  display:flex;
  justify-content:flex-end;
  gap:9px;
  border-top:1px solid #eceef1;
  margin-top:20px;
  padding-top:16px;
}
.new-template-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:16px;
}
.new-template-card{
  border:1px solid #e0e3e7;
  border-radius:13px;
  padding:10px;
  background:#fff;
  box-shadow:0 2px 9px rgba(16,24,40,.04);
}
.new-template-card:hover{
  border-color:#efb16c;
  box-shadow:0 7px 18px rgba(16,24,40,.07);
}
.new-template-preview{
  height:160px;
  border-radius:9px;
  background:#f1f3f5;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.new-template-preview img{
  width:100%;
  height:100%;
  object-fit:contain;
}
.new-template-meta{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:10px 2px;
}
.new-template-meta strong{font-size:13px}
.new-template-meta span{font-size:11px;color:#747b84}
@media(max-width:760px){
  .start-choice-grid{grid-template-columns:1fr}
  .new-project-form-grid{grid-template-columns:1fr}
  .new-project-form-grid .span-2{grid-column:auto}
  .new-project-preview{grid-template-columns:1fr}
}


/* ===== V3.8 Rotation & font management ===== */
.rotation-control{
  display:grid;
  gap:7px;
  padding:10px;
  border:1px solid #ece7f7;
  background:#faf8ff;
  border-radius:9px;
}
.rotation-control label{
  margin:0!important;
}
.rotation-buttons{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:5px;
}
.font-manager{
  width:min(1050px,94vw);
  margin:0 auto;
  padding:30px 0 60px;
}
.font-manager-head h1{margin:0 0 5px}
.font-manager-head p{margin:0;color:#707780}
.font-add-card,
.font-list-card{
  margin-top:20px;
  background:#fff;
  border:1px solid #e0e3e7;
  border-radius:14px;
  padding:20px;
  box-shadow:0 4px 18px rgba(16,24,40,.05);
}
.font-add-card h2,
.font-list-card h2{
  margin:0 0 14px;
  font-size:17px;
}
.font-add-grid{
  display:grid;
  grid-template-columns:2fr 1fr;
  gap:14px;
}
.font-add-grid label{
  font-size:12px;
  font-weight:650;
  color:#555d67;
}
.font-add-grid input{
  width:100%;
  margin-top:5px;
  padding:10px 11px;
  border:1px solid #d4d9df;
  border-radius:8px;
}
.font-help{
  font-size:12px;
  color:#737a84;
  line-height:1.45;
}
.font-list-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.font-manager-list{
  display:grid;
  gap:8px;
}
.font-manager-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto auto;
  gap:12px;
  align-items:center;
  padding:11px 12px;
  border:1px solid #e2e5e9;
  border-radius:9px;
  background:#fafafa;
}
.font-manager-preview{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.font-manager-preview strong{
  font-size:15px;
}
.font-manager-preview span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:13px;
}
.font-manager-meta{
  font-size:11px;
  color:#777e87;
  white-space:nowrap;
}
@media(max-width:760px){
  .font-add-grid{grid-template-columns:1fr}
  .font-manager-row{grid-template-columns:1fr}
}


/* ===== V3.9 Project groups & layer DnD ===== */
.groups-toolbar{
  display:flex;
  align-items:center;
  gap:8px;
  margin:0 0 18px;
  flex-wrap:wrap;
}
.groups-hint{
  font-size:11px;
  color:#777e87;
  margin-left:auto;
}
.group-manager{
  background:#fff;
  border:1px solid #e0e3e7;
  border-radius:12px;
  padding:14px;
  margin-bottom:20px;
}
.group-manager h3{
  margin:0 0 10px;
}
.group-manager-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:15px;
  padding:9px 10px;
  border-top:1px solid #edf0f2;
}
.group-manager-row:first-child{border-top:0}
.group-manager-row > div:first-child{
  display:flex;
  flex-direction:column;
  gap:3px;
}
.group-manager-row strong{font-size:13px}
.group-manager-row span{font-size:11px;color:#777e87}
.group-manager-actions{display:flex;gap:6px}

.project-groups-view{
  display:flex;
  flex-direction:column;
  gap:26px;
}
.project-group-section{
  background:#fff;
  border:1px solid #e1e4e8;
  border-radius:14px;
  overflow:hidden;
  box-shadow:0 3px 14px rgba(16,24,40,.04);
}
.project-group-head{
  min-height:58px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:12px 15px;
  background:linear-gradient(90deg,#f8f9fa,#fff);
  border-bottom:1px solid #e8eaed;
  transition:background .15s,border-color .15s;
}
.project-group-head.drag-over{
  background:#fff2e2;
  border-color:#ef7d00;
  box-shadow:inset 0 0 0 2px rgba(239,125,0,.22);
}
.project-group-head h2{
  margin:0;
  font-size:16px;
}
.project-group-head span{
  display:block;
  margin-top:3px;
  font-size:11px;
  color:#777e87;
}
.group-project-grid{
  padding:15px;
}
.draggable-project{
  cursor:grab;
}
.draggable-project:active{
  cursor:grabbing;
}
.project-group-select-label{
  display:block;
  font-size:10px;
  color:#747b84;
  margin:8px 0;
}
.project-group-select{
  width:100%;
  margin-top:4px;
  padding:7px 8px;
  border:1px solid #d8dde3;
  border-radius:7px;
  background:#fff;
  font-size:12px;
}
.group-empty{
  grid-column:1/-1;
  padding:18px;
  margin:0;
  background:#fafafa;
  border:1px dashed #dfe3e8;
}
.layer-row{
  cursor:grab;
}
.layer-row.dragging{
  opacity:.38;
}
.layer-row.drag-over{
  border-color:#ef7d00!important;
  background:#fff2e2!important;
  box-shadow:0 0 0 2px rgba(239,125,0,.12);
}
@media(max-width:760px){
  .groups-hint{width:100%;margin-left:0}
  .group-manager-row{align-items:flex-start;flex-direction:column}
}


/* ===== V4.0 Project sharing ===== */
.shared-projects-virtual{
  margin-bottom:26px;
}
.shared-group-section{
  border-color:#b9d7ff;
  box-shadow:0 5px 18px rgba(37,99,235,.07);
}
.shared-group-head{
  background:linear-gradient(90deg,#eff6ff,#ffffff);
  border-bottom-color:#cfe2ff;
}
.shared-group-head h2{
  color:#1d4ed8;
}
.shared-badge{
  display:inline-flex!important;
  align-items:center;
  margin:0!important;
  padding:5px 9px;
  border-radius:999px;
  background:#dbeafe;
  color:#1d4ed8!important;
  font-size:10px!important;
  font-weight:750;
}
.shared-project-card{
  border-color:#d9e8fb;
  background:linear-gradient(180deg,#fff,#fbfdff);
}
.shared-owner-line{
  display:inline-flex;
  margin-top:9px;
  padding:4px 7px;
  border-radius:6px;
  background:#eff6ff;
  color:#2563eb;
  font-size:10px;
  font-weight:650;
}
.project-select-check{
  display:flex;
  align-items:center;
  gap:6px;
  margin-bottom:7px;
  font-size:10px;
  color:#6e7680;
  cursor:pointer;
}
.project-select-check input{
  margin:0;
}
.share-selected-btn{
  border-color:#9dc6ff;
  background:#f3f8ff;
  color:#175cd3;
}
.share-project-dialog{
  width:min(650px,92vw);
}
.share-dialog-body{
  padding:18px;
}
.share-dialog-body > label{
  font-size:12px;
  font-weight:650;
  color:#535a64;
}
.share-email-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
  margin-top:6px;
}
.share-email-row input{
  width:100%;
  padding:10px 11px;
  border:1px solid #d3d9e0;
  border-radius:8px;
}
.share-list-title{
  margin:20px 0 8px;
  padding-top:14px;
  border-top:1px solid #e7eaee;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:#777f89;
  font-weight:750;
}
.share-list{
  display:grid;
  gap:7px;
}
.share-list-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px 11px;
  border:1px solid #e1e5ea;
  border-radius:9px;
  background:#fafbfc;
}
.share-list-row > div{
  display:flex;
  flex-direction:column;
  gap:3px;
}
.share-list-row strong{
  font-size:12px;
}
.share-list-row span{
  font-size:10px;
  color:#737b85;
}
.shared-edit-badge{
  display:inline-flex;
  align-items:center;
  padding:4px 7px;
  border-radius:999px;
  background:#e8f1ff;
  border:1px solid #bdd7ff;
  color:#175cd3;
  font-size:10px;
  font-weight:750;
  white-space:nowrap;
}
@media(max-width:650px){
  .share-email-row{grid-template-columns:1fr}
  .share-list-row{align-items:flex-start;flex-direction:column}
}


/* ===== V4.1 Share visibility & owner overview ===== */
.project-share-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin-top:9px;
  padding:4px 8px;
  border-radius:999px;
  font-size:10px;
  font-weight:750;
  width:max-content;
}
.project-share-badge.shared{
  background:#ecfdf3;
  color:#027a48;
  border:1px solid #abefc6;
}
.project-share-badge.private{
  background:#f2f4f7;
  color:#667085;
  border:1px solid #e4e7ec;
}
.project-share-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  background:currentColor;
  opacity:.9;
}

.owned-shares-overview{
  margin-bottom:26px;
  padding:18px;
  background:linear-gradient(180deg,#fbfffc,#fff);
  border:1px solid #b7e4c7;
  border-radius:14px;
  box-shadow:0 4px 18px rgba(2,122,72,.06);
}
.owned-shares-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:14px;
}
.owned-shares-head h2{
  margin:0 0 4px;
  font-size:17px;
  color:#067647;
}
.owned-shares-head p{
  margin:0;
  font-size:11px;
  color:#667085;
}
.owned-shares-count{
  display:inline-flex;
  align-items:center;
  padding:5px 9px;
  border-radius:999px;
  background:#dcfae6;
  color:#067647;
  font-size:10px;
  font-weight:750;
  white-space:nowrap;
}
.owned-shares-list{
  display:grid;
  gap:11px;
}
.owned-share-project{
  background:#fff;
  border:1px solid #dbe5df;
  border-radius:11px;
  overflow:hidden;
}
.owned-share-project-main{
  display:grid;
  grid-template-columns:58px minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
  padding:10px 12px;
}
.owned-share-mini-preview{
  width:58px;
  height:48px;
  border-radius:7px;
  background:#f1f4f2;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  font-size:9px;
  color:#888;
}
.owned-share-mini-preview img{
  width:100%;
  height:100%;
  object-fit:contain;
}
.owned-share-project-meta{
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width:0;
}
.owned-share-project-meta strong{
  font-size:12px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.owned-share-project-meta span{
  font-size:10px;
  color:#667085;
}
.owned-share-users{
  border-top:1px solid #edf1ee;
  background:#fbfdfb;
}
.owned-share-user-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 12px;
  border-top:1px solid #edf1ee;
}
.owned-share-user-row:first-child{
  border-top:0;
}
.owned-share-user-row > div{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.owned-share-user-row strong{
  font-size:11px;
}
.owned-share-user-row span{
  font-size:10px;
  color:#667085;
}
@media(max-width:700px){
  .owned-shares-head{
    flex-direction:column;
  }
  .owned-share-project-main{
    grid-template-columns:48px minmax(0,1fr);
  }
  .owned-share-project-main > .btn{
    grid-column:1/-1;
  }
  .owned-share-user-row{
    flex-direction:column;
    align-items:flex-start;
  }
}


/* ===== V4.2 Mobile / Touch Optimization ===== */
.mobile-editor-toggle{display:none}
.mobile-panel-backdrop{display:none}

@media (pointer:coarse){
  .btn,button,select,input[type="button"],input[type="submit"]{min-height:44px}
  input,select,textarea{font-size:16px!important}
}

@media(max-width:760px){
  body{overflow-x:hidden}
  .topbar{min-height:58px;height:auto;padding:9px 12px;gap:8px;flex-wrap:wrap}
  .topbar strong{flex:1 1 auto;min-width:0;font-size:15px}
  .dashboard{padding:18px 12px 34px}
  .dash-head{align-items:flex-start;flex-direction:column;gap:14px}
  .dash-buttons{width:100%;display:grid;grid-template-columns:1fr;gap:8px}
  .dash-buttons .btn,.dash-buttons .file-btn{width:100%;justify-content:center;text-align:center}

  .groups-toolbar{display:grid;grid-template-columns:1fr;gap:7px}
  .groups-toolbar .btn{width:100%}
  .groups-hint{margin:2px 0 0;width:100%;line-height:1.4}
  .project-grid{grid-template-columns:1fr;gap:12px}
  .project-card{padding:12px}
  .preview{height:min(52vw,220px)}
  .project-card .actions{display:grid;grid-template-columns:1fr}
  .project-card .actions .btn{width:100%;text-align:center}
  .project-group-select{min-height:44px}
  .project-group-head{align-items:flex-start;flex-direction:column}
  .project-group-head .btn{width:100%}

  .owned-shares-overview{padding:12px}
  .owned-share-project-main{grid-template-columns:54px 1fr}
  .owned-share-project-main>.btn{grid-column:1/-1;width:100%;text-align:center}
  .owned-share-user-row .btn{width:100%}
  .group-manager{padding:10px}
  .group-manager-actions{width:100%;display:grid;grid-template-columns:1fr 1fr}
}

@media(max-width:650px){
  .template-dialog,.share-project-dialog,.export-pages-dialog{
    width:calc(100vw - 16px);max-width:none;max-height:calc(100dvh - 16px);margin:auto;border-radius:12px
  }
  .template-dialog-head{padding:14px;position:sticky;top:0;z-index:4}
  .template-list,.share-dialog-body,.export-pages-body{padding:12px}
  .template-list{grid-template-columns:1fr}
  .share-email-row{grid-template-columns:1fr}
  .share-email-row .btn,.share-list-row .btn{width:100%}
  .export-format-row{align-items:stretch;flex-direction:column}
  .export-format-row .btn{width:100%}
  .export-page-option{min-height:48px}
  .export-dialog-actions{display:grid;grid-template-columns:1fr}
}

@media(max-width:760px){
  .new-project-wrap{width:auto;padding:20px 12px 40px}
  .new-project-head h1{font-size:23px}
  .start-choice-grid{grid-template-columns:1fr;gap:10px}
  .start-choice{min-height:104px;padding:14px;grid-template-columns:42px 1fr}
  .start-choice-icon{width:42px;height:42px}
  .new-project-panel{padding:14px}
  .new-project-form-grid{grid-template-columns:1fr;gap:10px}
  .new-project-form-grid .span-2{grid-column:auto}
  .new-project-preview{grid-template-columns:1fr;justify-items:center}
  .new-project-preview>div:first-child{justify-self:stretch}
  .new-project-actions{display:grid;grid-template-columns:1fr}
  .new-project-actions .btn{width:100%;text-align:center}
  .new-template-grid{grid-template-columns:1fr}

  .font-manager{width:auto;padding:20px 12px 40px}
  .font-add-card,.font-list-card{padding:14px}
  .font-add-grid{grid-template-columns:1fr}
  .font-add-card .btn{width:100%}
  .font-list-head{align-items:flex-start;flex-direction:column;gap:8px}
  .font-list-head .btn{width:100%}
  .font-manager-row{grid-template-columns:1fr}
  .font-manager-row .btn{width:100%}
}

@media(max-width:900px){
  .editor-page{overflow:hidden}
  .editor-top{
    display:grid;grid-template-columns:auto auto 1fr;min-height:58px;height:auto;padding:7px 8px;gap:6px
  }
  .editor-top>a:first-child{grid-column:1;align-self:center;font-size:12px}
  .editor-top #projectTitle{grid-column:1/-1;width:100%;max-width:none;order:2;min-height:38px}
  .mobile-editor-toggle{
    display:inline-flex;align-items:center;justify-content:center;min-height:40px;border:1px solid #555;
    border-radius:7px;background:#343536;color:#fff;padding:7px 9px;font-size:12px
  }
  .mobile-tools-toggle{grid-column:1/2;order:3}
  .mobile-layers-toggle{grid-column:2/3;order:3}
  .top-actions{
    grid-column:1/-1;order:4;width:100%;overflow-x:auto;display:flex;gap:6px;padding-bottom:2px;scrollbar-width:thin
  }
  .top-actions .btn,.top-actions .file-btn{flex:0 0 auto;min-height:40px;font-size:12px}

  .editor-shell,.editor-v2,.editor-v3{grid-template-columns:1fr!important;height:calc(100dvh - 158px)}
  #editorSidebar,#editorLayers{
    display:block!important;position:fixed;top:0;bottom:0;width:min(88vw,340px);z-index:1002;overflow-y:auto;
    overscroll-behavior:contain;transition:transform .22s ease;box-shadow:0 10px 35px rgba(0,0,0,.28)
  }
  #editorSidebar{left:0;transform:translateX(-105%)}
  #editorLayers{right:0;transform:translateX(105%)}
  #editorSidebar.mobile-open,#editorLayers.mobile-open{transform:translateX(0)}
  .mobile-panel-backdrop{position:fixed;inset:0;z-index:1001;background:rgba(0,0,0,.42)}
  .mobile-panel-backdrop.show{display:block}
  body.mobile-panel-open{overflow:hidden}

  .canvas-area{padding:0;min-width:0}
  .pages-toolbar{padding:7px;overflow-x:auto;flex-wrap:nowrap}
  .pages-toolbar .btn{flex:0 0 auto;white-space:nowrap;min-height:40px}
  .pages-toolbar-info{flex:0 0 auto;margin-left:4px}
  .multi-page-scroll{padding:16px 10px 50px;overflow:auto;-webkit-overflow-scrolling:touch}
  .pages-container{gap:30px}
  .design-page-shell{max-width:100%}
  .design-page-header{grid-template-columns:auto minmax(120px,1fr);gap:6px;width:min(100%,calc(100vw - 28px))}
  .active-page-badge{display:none}
  .design-page-name{min-width:0;width:100%;font-size:12px!important}

  .sidebar-brand{position:sticky;top:0;z-index:5}
  .accordion{padding-bottom:30px}
  .acc-section summary{min-height:58px}
  .acc-content{padding:12px}
  .field-grid.two{grid-template-columns:1fr}
  .tool-grid,.button-grid{grid-template-columns:1fr 1fr}
  .segmented{grid-template-columns:1fr 1fr}
  .segmented .btn{min-height:40px}
  .rotation-buttons{grid-template-columns:repeat(3,1fr)}

  .layers-panel{padding:10px}
  .layers-head{top:0;padding:8px 0}
  .layer-row{min-height:48px}
  .layer-label{min-height:40px}
  .layer-icon{min-width:36px;min-height:40px}
}

@media(max-width:480px){
  .editor-top{grid-template-columns:1fr 1fr}
  .editor-top>a:first-child{grid-column:1}
  .editor-top .app-version{grid-column:2;justify-self:end}
  .editor-top .shared-edit-badge{grid-column:1/-1}
  .mobile-tools-toggle,.mobile-layers-toggle{width:100%}
  .tool-grid,.button-grid,.segmented{grid-template-columns:1fr}
  .rotation-buttons{grid-template-columns:1fr 1fr 1fr}
}

@supports(padding:max(0px)){
  @media(max-width:900px){
    #editorSidebar,#editorLayers{padding-bottom:max(20px,env(safe-area-inset-bottom))}
    .multi-page-scroll{padding-bottom:max(50px,calc(env(safe-area-inset-bottom) + 25px))}
  }
}

.mobile-canvas-bar{display:none}
@media(max-width:900px){
  .editor-shell,.editor-v2,.editor-v3{height:calc(100dvh - var(--editor-mobile-top,158px) - 58px)!important;min-height:220px}
  .multi-page-area{height:100%;min-height:0}
  .multi-page-scroll{height:100%;min-height:0;overflow-y:auto!important;overflow-x:auto!important;touch-action:pan-x pan-y;overscroll-behavior:contain;padding-bottom:90px!important;-webkit-overflow-scrolling:touch}
  .pages-container{min-height:max-content}
  .design-page-shell{scroll-margin-top:14px;scroll-margin-bottom:20px}
  .page-canvas-wrap,.page-canvas-wrap canvas,.page-canvas-wrap .canvas-container{touch-action:auto!important}
  .mobile-canvas-bar{
    display:grid;grid-template-columns:auto 42px minmax(90px,1fr) 42px auto;align-items:center;gap:5px;
    position:fixed;left:8px;right:8px;bottom:max(7px,env(safe-area-inset-bottom));z-index:900;
    min-height:50px;padding:6px;border:1px solid #d5dae0;border-radius:13px;background:rgba(255,255,255,.96);
    box-shadow:0 7px 28px rgba(0,0,0,.22);backdrop-filter:blur(8px)
  }
  .mobile-canvas-btn,.mobile-page-select{min-height:38px;border:1px solid #d7dce2;border-radius:8px;background:#fff;color:#333940;font-size:11px;font-weight:650;padding:6px 8px}
  .mobile-canvas-btn.icon-only{padding:0;font-size:23px}
  .mobile-canvas-btn.mode-scroll{background:#eff6ff;color:#175cd3;border-color:#b2ccff}
  .mobile-canvas-btn.mode-edit{background:#fff3e8;color:#b85b00;border-color:#f4bd83}
  .mobile-page-select{width:100%;min-width:0;font-size:12px!important;text-overflow:ellipsis}
  .status{display:none}
}
@media(max-width:560px){
  .mobile-canvas-bar{grid-template-columns:1fr 38px minmax(76px,1.15fr) 38px}
  .mobile-canvas-bar .mobile-canvas-btn:last-child{grid-column:1/-1;min-height:32px}
}


/* ===== V4.3.1 Font entry points / migration UI ===== */
.font-add-inline{
  display:flex;
  width:100%;
  margin-top:7px;
  justify-content:center;
  font-size:12px;
}
@media(max-width:900px){
  .font-add-inline{min-height:44px;align-items:center}
}


/* ===== V4.3.3 Font installation status ===== */
.font-status{
  min-height:20px;
  margin-top:10px;
  font-size:13px;
  line-height:1.4;
}
.font-status.ok{color:#18794e}
.font-status.error{color:#b42318}
.font-add-card button:disabled{opacity:.55;cursor:wait}


/* ===== V4.4 Project/Page ID-SKU ===== */
.project-automation-id{
  min-width:190px;
  max-width:260px;
  font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
  font-size:12px;
}
.design-page-header{
  gap:8px;
  flex-wrap:wrap;
}
.design-page-sku{
  min-width:190px;
  max-width:280px;
  padding:7px 9px;
  border:1px solid #cfd6df;
  border-radius:7px;
  background:#f8fafc;
  font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
  font-size:11px;
}
.design-page-shell.active .design-page-sku{
  background:#fff;
  border-color:#94a3b8;
}
@media(max-width:900px){
  .project-automation-id{min-width:170px;max-width:none;flex:1 1 180px;min-height:44px}
  .design-page-sku{min-width:0;flex:1 1 100%;min-height:40px;font-size:12px}
}


/* ===== V4.5 Server Automation ===== */
.automation-page{max-width:1180px;margin:0 auto;padding:24px}
.automation-head{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-bottom:18px}
.automation-card{background:#fff;border:1px solid #dbe1e8;border-radius:14px;padding:18px;margin-bottom:18px;box-shadow:0 4px 18px rgba(15,23,42,.05)}
.automation-card h2{margin-top:0}
.automation-grid{display:grid;grid-template-columns:repeat(4,minmax(140px,1fr));gap:12px;margin-bottom:12px}
.automation-card label{display:flex;flex-direction:column;gap:6px;margin-bottom:10px}
.automation-card input,.automation-card select,.automation-card textarea{width:100%;padding:10px;border:1px solid #cbd5e1;border-radius:8px;font:inherit;box-sizing:border-box}
.automation-card textarea{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px}
.automation-help{font-size:13px;color:#64748b}
.automation-pages{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 14px}
.automation-pages label{display:flex;flex-direction:row;align-items:center;gap:7px;border:1px solid #dbe1e8;border-radius:8px;padding:8px 10px;margin:0}
.automation-pages input{width:auto}
.automation-card-head{display:flex;align-items:center;justify-content:space-between}
.automation-job{display:grid;grid-template-columns:auto auto 1fr;gap:8px 14px;padding:10px 0;border-bottom:1px solid #edf0f3;align-items:center}
.job-status{padding:3px 7px;border-radius:999px;background:#eef2f7;font-size:11px;text-transform:uppercase}
.job-status.done{background:#dcfce7}.job-status.error{background:#fee2e2}.job-status.processing{background:#fef3c7}
.job-error,.job-file{grid-column:1/-1;font-size:12px}.job-error{color:#b42318}.job-file{color:#166534;font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
.dash-automation-hint{font-size:12px;color:#64748b;align-self:center}
#objectAutomationId{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px}
@media(max-width:800px){.automation-grid{grid-template-columns:1fr 1fr}.automation-page{padding:12px}.automation-job{grid-template-columns:1fr auto}}
@media(max-width:520px){.automation-grid{grid-template-columns:1fr}}

/* V4.5.3: sichtbare Speicher-Rückmeldung */
.editor-toast{
  position:fixed;right:22px;top:78px;z-index:99999;
  background:#20242a;color:#fff;padding:12px 18px;border-radius:9px;
  box-shadow:0 8px 28px rgba(0,0,0,.22);
  opacity:0;transform:translateY(-8px);pointer-events:none;
  transition:opacity .18s ease,transform .18s ease;font-weight:600
}
.editor-toast.show{opacity:1;transform:translateY(0)}
.editor-toast.error{background:#a61b1b}
#saveProjectButton:disabled{opacity:.65;cursor:wait}

/* V4.6.0 Jobs löschen */
.automation-job-actions{display:flex;gap:8px;flex-wrap:wrap}
.automation-job .job-select{display:inline-flex;align-items:center;gap:5px;margin-right:10px;font-size:.82rem}
.btn.danger{background:#9f1d1d;color:#fff;border-color:#9f1d1d}

/* V4.7.0 CSV-Massenproduktion */
.csv-mapping{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:9px;margin:10px 0 18px}
.csv-map-row{display:grid;grid-template-columns:minmax(90px,1fr) minmax(130px,1.4fr);gap:8px;align-items:center;padding:8px;border:1px solid #ddd;border-radius:8px;background:#fff}
.csv-map-row strong{overflow:hidden;text-overflow:ellipsis}
.csv-preview-wrap{max-width:100%;overflow:auto;border:1px solid #ddd;border-radius:8px;margin:8px 0 14px}
.csv-preview{border-collapse:collapse;width:max-content;min-width:100%;font-size:.85rem}
.csv-preview th,.csv-preview td{padding:7px 9px;border-bottom:1px solid #eee;border-right:1px solid #eee;white-space:nowrap;max-width:320px;overflow:hidden;text-overflow:ellipsis}
.csv-preview th{position:sticky;top:0;background:#f5f5f5;text-align:left}
.csv-run-grid{margin-top:12px}

/* V4.8.0 SVG-/Canva-Vorlagenimport */
.svg-import-options{margin-top:12px;padding:10px;border:1px solid #ddd;border-radius:10px;background:#fafafa}
.svg-import-options>label{display:block;margin:7px 0}
.svg-import-report{margin-top:10px;padding:10px;border-radius:8px;background:#fff;border:1px solid #d8d8d8;font-size:.88rem;line-height:1.45}
.svg-sku-list{margin-top:7px;padding:7px 9px;background:#f5f5f5;border-radius:6px;font-family:monospace}
.svg-warning{margin-top:8px;padding:8px;border-radius:6px;background:#fff4df;border:1px solid #edc985}

/* V4.10.0 Canva/SVG Import */
.svg-canva-hint{margin-top:10px}
.svg-import-report strong{font-weight:700}

/* V4.10.8 Canva-Vektortext */
.canva-vector-text-hint{margin-bottom:12px}
.canva-vector-text-hint .btn{margin-top:8px}

/* V4.12.0 SVG Batch-Mapping */
.svg-automation-assistant{margin-top:14px;padding-top:10px;border-top:1px solid rgba(0,0,0,.12)}
.svg-auto-map-row{display:grid;grid-template-columns:minmax(120px,1fr) minmax(190px,1.3fr) minmax(140px,1fr);gap:8px;align-items:center;margin:8px 0}
.svg-auto-map-label{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.svg-auto-map-row select,.svg-auto-map-row input{width:100%;min-width:0}
@media(max-width:800px){
  .svg-auto-map-row{grid-template-columns:1fr}
}


/* V4.12.1 – schmale Sidebar / SVG Batch-Zuordnung */
.svg-automation-assistant,
.svg-automation-assistant *,
.acc-content,
.acc-content *{
  box-sizing:border-box;
}

.svg-automation-assistant{
  width:100%;
  max-width:100%;
  min-width:0;
  overflow:hidden;
}

.svg-automation-assistant .hint-box{
  width:100%;
  max-width:100%;
  min-width:0;
  overflow-wrap:anywhere;
  word-break:normal;
}

#svgAutomationMappingRows{
  width:100%;
  min-width:0;
}

.svg-auto-map-row{
  display:grid;
  grid-template-columns:1fr;
  gap:6px;
  width:100%;
  max-width:100%;
  min-width:0;
  margin:10px 0 12px;
}

.svg-auto-map-label{
  width:100%;
  min-width:0;
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
  line-height:1.25;
  overflow-wrap:anywhere;
}

.svg-auto-map-row select,
.svg-auto-map-row input,
.svg-automation-assistant select,
.svg-automation-assistant input{
  display:block;
  width:100%;
  max-width:100%;
  min-width:0;
}

.svg-automation-assistant .button-row{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  width:100%;
  min-width:0;
}

.svg-automation-assistant .button-row .btn,
.svg-automation-assistant .btn{
  width:100%;
  max-width:100%;
  min-width:0;
  white-space:normal;
  overflow-wrap:anywhere;
}

/* Generell keine Sidebar-Felder über den sichtbaren Bereich hinausragen lassen */
.editor-sidebar,
.editor-sidebar .acc-content,
.editor-sidebar label,
.editor-sidebar input,
.editor-sidebar select,
.editor-sidebar textarea,
.editor-sidebar button,
aside,
aside .acc-content,
aside label,
aside input,
aside select,
aside textarea,
aside button{
  max-width:100%;
  min-width:0;
}

.editor-sidebar input,
.editor-sidebar select,
.editor-sidebar textarea,
aside input,
aside select,
aside textarea{
  width:100%;
}

/* Die Zwei-Spalten-Felder dürfen in sehr schmalen Sidebars umbrechen */
@media (max-width: 1180px){
  .editor-sidebar .field-grid.two,
  aside .field-grid.two{
    grid-template-columns:1fr;
  }
}

/* Mobile / sehr schmale Fenster */
@media (max-width:800px){
  .svg-auto-map-row{
    grid-template-columns:1fr;
  }
}


/* V4.12.2 – dauerhafte Batch-Feldzuordnung */
.svg-auto-map-custom[hidden],
.project-batch-map-custom[hidden]{
  display:none !important;
}

#projectBatchMappingRows{
  width:100%;
  min-width:0;
}

.project-batch-map-row{
  display:grid;
  grid-template-columns:1fr;
  gap:6px;
  width:100%;
  min-width:0;
  padding:9px 0 11px;
  border-bottom:1px solid rgba(0,0,0,.09);
}

.project-batch-map-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
  width:100%;
  min-width:0;
}

.project-batch-map-name{
  min-width:0;
  font-size:13px;
  font-weight:600;
  overflow-wrap:anywhere;
}

.project-batch-map-current{
  flex:0 1 auto;
  max-width:45%;
  font-size:11px;
  opacity:.68;
  text-align:right;
  overflow-wrap:anywhere;
}

.project-batch-map-row select,
.project-batch-map-row input{
  display:block;
  width:100%;
  min-width:0;
  max-width:100%;
}

.batch-mapping-actions{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  margin-top:10px;
}

.batch-mapping-actions .btn{
  width:100%;
}


/* V4.13.0 – Seitenreihenfolge + projektweite Objekt-Zwischenablage */
.design-page-header{
  position:relative;
}

.design-page-drag{
  flex:0 0 auto;
  cursor:grab;
  border:1px solid rgba(0,0,0,.16);
  background:#fff;
  border-radius:6px;
  min-width:32px;
  height:32px;
  line-height:1;
  font-size:17px;
}

.design-page-drag:active{
  cursor:grabbing;
}

.design-page-shell.page-dragging{
  opacity:.55;
}

.design-page-shell.page-drag-over{
  outline:3px dashed #f28a00;
  outline-offset:6px;
}

.page-move-btn{
  flex:0 0 auto;
  min-width:32px;
}

.page-move-btn:disabled{
  opacity:.35;
  cursor:not-allowed;
}

.pages-toolbar{
  flex-wrap:wrap;
}

/* Einfügen-per-Klick Buttons auch in schmaler Sidebar sauber */
.acc-object .button-grid .btn{
  min-width:0;
  white-space:normal;
}

/* V4.13.1 – robustes Seiten-Drag&Drop */
.design-page-drag{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:32px;
  cursor:grab;
  user-select:none;
  touch-action:none;
}
.design-page-drag:active{cursor:grabbing}
.design-page-shell{position:relative}
.design-page-shell.page-drag-over-before::before,
.design-page-shell.page-drag-over-after::after{
  content:"";
  position:absolute;
  left:8px;
  right:8px;
  height:5px;
  border-radius:999px;
  background:#f28a00;
  z-index:50;
  pointer-events:none;
  box-shadow:0 0 0 2px rgba(255,255,255,.8);
}
.design-page-shell.page-drag-over-before::before{top:-10px}
.design-page-shell.page-drag-over-after::after{bottom:-10px}
.design-page-shell.page-dragging{opacity:.5}

/* V4.13.4 – Exportoptionen */
.export-quality-row{
  display:grid;
  gap:8px;
  margin:0 0 12px;
  padding:10px 12px;
  background:#f6f7f9;
  border-radius:9px;
}
.export-quality-row label{
  display:grid;
  gap:5px;
  font-size:13px;
  font-weight:650;
}
.export-quality-row select{
  width:100%;
  max-width:100%;
}
.export-compression-hint{
  margin:0;
  font-size:12px;
}


/* V4.14.0 – Automationsfelder + CSV Variantenvorschau */
.automation-field-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:10px;
  margin-top:12px;
}
.automation-field-card{
  display:grid;
  gap:4px;
  padding:11px 12px;
  border:1px solid #e0e3e7;
  border-radius:9px;
  background:#fff;
}
.automation-field-sku code{
  display:inline-block;
  font-size:13px;
  font-weight:750;
}
.automation-field-card small{
  color:#666d76;
  overflow-wrap:anywhere;
}
.automation-variant-preview{
  margin:16px 0;
  padding:12px;
  border:1px solid #dfe3e8;
  border-radius:10px;
  background:#f8f9fb;
}
.automation-preview-controls{
  display:flex;
  gap:8px;
  align-items:end;
  flex-wrap:wrap;
}
.automation-preview-controls label{
  display:grid;
  gap:4px;
  min-width:180px;
}
.automation-preview-stage{
  width:100%;
  min-height:220px;
  margin-top:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:auto;
  border:1px solid #d9dde3;
  border-radius:8px;
  background:#dfe2e6;
}
#csvDesignPreviewCanvas{
  display:block;
  max-width:100%;
  height:auto;
  box-shadow:0 5px 20px rgba(0,0,0,.18);
}
.automation-preview-values{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:9px;
}
.automation-preview-value{
  display:inline-block;
  padding:4px 7px;
  border-radius:999px;
  background:#fff;
  border:1px solid #dfe3e8;
  font-size:11px;
}
.csv-preview-row{cursor:pointer}
.csv-preview-row:hover{background:#fff3e6}
@media(max-width:760px){
  .automation-preview-controls{
    display:grid;
    grid-template-columns:1fr;
  }
  .automation-preview-controls label{min-width:0}
}

/* V4.14.2: Projektaktionen innerhalb der Karte halten; Löschaktion eigene Zeile. */
.project-card .actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;min-width:0}
.project-card .actions>.btn{min-width:0;width:100%;box-sizing:border-box;white-space:normal;text-align:center;overflow-wrap:anywhere;display:flex;align-items:center;justify-content:center}
.project-card .actions>.project-delete-btn{grid-column:1/-1;min-height:40px}
@media(max-width:760px){.project-card .actions{grid-template-columns:1fr 1fr}.project-card .actions>.btn:first-child{grid-column:1/-1}.project-card .actions>.project-delete-btn{grid-column:1/-1}}

/* V4.14.3: Projektweiter Präzisionszoom mit korrekt reservierter Layoutfläche. */
.page-zoom-stage{position:relative;flex:none;overflow:visible;}
.page-zoom-stage>.page-canvas-wrap{position:absolute;top:0;left:0;}
.zoom-readout{display:flex;align-items:center;justify-content:center;gap:12px;}
.zoom-readout #zoomValue{min-width:60px;text-align:center;font-weight:700;}
.zoom-quick-actions{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0;}
.zoom-tip{font-size:11px;line-height:1.4;color:#69717d;margin:8px 0 0;}
