.documents-main{min-width:0;background:#f6f8fc;min-height:100vh}.documents-topbar{min-height:84px;background:#fff;border-bottom:1px solid #e7eaf0;display:flex;align-items:center;justify-content:space-between;padding:16px 28px;gap:20px;position:sticky;top:0;z-index:20}.documents-title-row{display:flex;align-items:center;gap:14px}.documents-title-row h1{margin:0;font-size:24px;color:#182033}.documents-title-row p{margin:4px 0 0;color:#677085}.documents-profile{display:flex;align-items:center;gap:10px}.documents-profile label{font-size:12px;color:#737b8f;font-weight:700;text-transform:uppercase}.documents-profile select{min-width:220px;border:1px solid #dce1ea;border-radius:10px;padding:10px 36px 10px 12px;background:#fff;color:#20283b}.documents-workspace{padding:24px 28px}.business-context{display:flex;align-items:flex-start;gap:12px;padding:14px 16px;margin-bottom:16px;border-color:#cfe0ff;background:#f7faff}.business-context-icon{flex:0 0 38px;width:38px;height:38px;border-radius:10px;display:grid;place-items:center;background:#2456d7;color:#fff;font-weight:800}.business-context span{display:block;font-size:11px;line-height:1.2;color:#6f7890;font-weight:800;text-transform:uppercase;letter-spacing:.04em}.business-context strong{display:block;margin-top:3px;color:#17213a;font-size:15px}.business-context p{margin:3px 0 0;color:#657089;font-size:13px;line-height:1.4}
.document-type-tabs{display:flex;gap:5px;overflow:auto;border-bottom:1px solid #dfe4ec;margin-bottom:18px}.document-type-tabs button{border:0;background:transparent;padding:12px 18px;color:#626c80;font-weight:700;white-space:nowrap;border-bottom:3px solid transparent;cursor:pointer}.document-type-tabs button.active{color:#2456d7;border-bottom-color:#2456d7}.panel-card{background:#fff;border:1px solid #e2e6ee;border-radius:14px}.designer-toolbar{padding:14px 16px;display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:16px}.designer-toolbar>div:first-child{display:flex;align-items:center;gap:10px}.design-status{font-size:12px;border-radius:20px;padding:4px 9px;font-weight:700}.design-status.draft{background:#fff4d8;color:#8a6500}.design-status.published{background:#e6f7ed;color:#16713a}.designer-actions{display:flex;gap:9px;align-items:center}.designer-actions button,.upload-layout{cursor:pointer}.upload-layout{display:inline-flex;align-items:center;justify-content:center;padding:10px 14px;border-radius:10px;background:#eef3ff;color:#234fbf;font-weight:700}.designer-grid{display:grid;grid-template-columns:230px minmax(480px,1fr) 250px;gap:16px;align-items:start}.designer-panel{padding:16px;position:sticky;top:108px}.panel-heading h2{font-size:16px;margin:0;color:#232b3f}.panel-heading p{font-size:13px;color:#788195;margin:5px 0 14px}.placeholder-palette{display:grid;gap:7px}.placeholder-item{width:100%;display:flex;align-items:center;justify-content:space-between;border:1px solid #e0e5ed;background:#fff;border-radius:9px;padding:9px 10px;cursor:grab;text-align:left;color:#344057}.placeholder-item:hover{border-color:#9cb3ef;background:#f7f9ff}.placeholder-item small{font-size:10px;color:#8891a3}.canvas-panel{min-height:690px;padding:16px;overflow:hidden}.empty-canvas{min-height:640px;border:2px dashed #cfd6e2;border-radius:12px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:40px;color:#697287}.empty-canvas h2{margin:10px 0 8px;color:#293248}.empty-canvas p{max-width:520px;line-height:1.55}.upload-icon{width:54px;height:54px;border-radius:50%;display:grid;place-items:center;background:#edf2ff;color:#2456d7;font-size:28px}.canvas-wrap{min-height:640px}.canvas-ruler{display:flex;justify-content:space-between;color:#7c8597;font-size:12px;margin-bottom:10px}.page-stage{background:#e8ecf3;border-radius:10px;padding:20px;overflow:auto;max-height:760px;display:flex;justify-content:center;align-items:flex-start}.canvas-scale-frame{position:relative;flex:0 0 auto}.document-canvas{width:794px;min-height:1123px;margin:0;position:relative;background:#fff;box-shadow:0 8px 28px rgba(31,42,66,.18);transform-origin:top left}.document-canvas>img{display:block;width:100%;height:100%;position:absolute;inset:0;object-fit:fill;pointer-events:none;user-select:none}.element-layer{position:absolute;inset:0}.design-element{position:absolute;border:1px dashed #365ecb;background:transparent;color:#1b2b53;display:flex;align-items:flex-start;padding:4px;overflow:hidden;cursor:move;box-sizing:border-box;white-space:pre-wrap;line-height:1.25}.design-element.selected{outline:2px solid #2456d7;border-style:solid;background:transparent}.design-element .resize-handle{position:absolute;width:12px;height:12px;right:-1px;bottom:-1px;background:#2456d7;border:2px solid #fff;cursor:nwse-resize}.properties-panel label{display:block;margin-bottom:10px}.properties-panel label span{display:block;font-size:12px;color:#626c80;margin-bottom:5px;font-weight:700}.properties-panel input,.properties-panel select{width:100%;box-sizing:border-box;border:1px solid #dce1e9;border-radius:8px;padding:9px;background:#fff}.property-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.properties-empty{padding:28px 8px;text-align:center;color:#8b93a3;font-size:13px}.danger-btn{width:100%;border:1px solid #efc6c6;background:#fff3f3;color:#b32626;border-radius:9px;padding:10px;font-weight:700;cursor:pointer}.designer-note{font-size:12px;line-height:1.5;color:#7b8496;border-top:1px solid #e8ebf1;margin-top:16px;padding-top:14px}.toast{position:fixed;right:24px;bottom:24px;background:#20283a;color:#fff;padding:12px 16px;border-radius:10px;opacity:0;transform:translateY(10px);pointer-events:none;transition:.2s;z-index:99}.toast.show{opacity:1;transform:none}.toast.error{background:#9e2424}@media(max-width:1180px){.designer-grid{grid-template-columns:200px minmax(420px,1fr)}.properties-panel{grid-column:1/-1;position:static}.properties-panel #propertiesForm{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.properties-panel .designer-note{grid-column:1/-1}}@media(max-width:780px){.documents-topbar{align-items:flex-start;flex-direction:column;padding:14px 16px}.documents-profile{width:100%;justify-content:space-between}.documents-profile select{min-width:0;flex:1}.documents-workspace{padding:16px}.designer-toolbar{align-items:flex-start;flex-direction:column}.designer-grid{display:block}.designer-panel{position:static;margin-bottom:14px}.canvas-panel{margin-bottom:14px}.placeholder-palette{grid-template-columns:1fr 1fr}.page-stage{padding:10px}.document-canvas{margin:0}.properties-panel #propertiesForm{display:block}}

.canvas-panel{position:relative}.upload-busy{position:absolute;inset:16px;z-index:12;border-radius:12px;background:rgba(255,255,255,.94);backdrop-filter:blur(3px);display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:36px;color:#293248}.upload-busy[hidden]{display:none}.upload-busy strong{font-size:18px;margin-top:14px}.upload-busy>span{margin-top:6px;color:#6f7890;max-width:430px}.upload-spinner{width:42px;height:42px;border:4px solid #dce6ff;border-top-color:#2456d7;border-radius:50%;animation:documentUploadSpin .8s linear infinite}.upload-progress{width:min(360px,80%);height:9px;background:#e8edf6;border-radius:999px;overflow:hidden;margin-top:20px}.upload-progress span{display:block;width:0;height:100%;background:#2456d7;border-radius:inherit;transition:width .15s ease}.upload-progress.indeterminate span{width:38%;animation:documentUploadProgress 1.1s ease-in-out infinite}.upload-busy small{margin-top:8px;color:#667085;font-weight:700}.upload-layout.is-busy{opacity:.6;cursor:wait}.designer-actions button:disabled{opacity:.55;cursor:not-allowed}@keyframes documentUploadSpin{to{transform:rotate(360deg)}}@keyframes documentUploadProgress{0%{transform:translateX(-110%)}100%{transform:translateX(285%)}}

/* Drag-and-drop layout upload */
.canvas-panel{isolation:isolate}.empty-canvas{transition:border-color .18s ease,background-color .18s ease,box-shadow .18s ease}.drop-hint{display:block;margin-top:14px;color:#8a93a5}.drop-overlay{position:absolute;inset:16px;z-index:11;border:2px dashed #2456d7;border-radius:12px;background:rgba(238,243,255,.96);display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:#2456d7;pointer-events:none}.drop-overlay[hidden]{display:none}.drop-overlay-icon{width:58px;height:58px;border-radius:50%;display:grid;place-items:center;background:#fff;font-size:31px;box-shadow:0 8px 22px rgba(36,86,215,.16);margin-bottom:14px}.drop-overlay strong{font-size:20px;color:#173b9b}.drop-overlay span{margin-top:6px;color:#667596}.canvas-panel.is-file-dragging .empty-canvas{border-color:#2456d7;background:#f6f8ff;box-shadow:inset 0 0 0 3px rgba(36,86,215,.08)}.canvas-panel.is-file-dragging .canvas-wrap{opacity:.28}

/* Step 1: smart fields, custom text and sizing controls */
.properties-panel textarea{width:100%;resize:vertical;min-height:88px;border:1px solid #d7e0ec;border-radius:10px;padding:10px 11px;font:inherit;color:#0f172a;background:#fff}
.properties-panel label>small{display:block;margin-top:5px;color:#64748b;font-size:12px;line-height:1.45}
.property-checks{display:grid;gap:8px;margin:2px 0 4px}
.property-check{display:flex!important;align-items:center;gap:9px;border:1px solid #e2e8f0;border-radius:10px;padding:9px 10px;background:#f8fafc;cursor:pointer}
.property-check input{width:16px!important;height:16px;min-width:16px;margin:0;padding:0}
.property-check span{margin:0!important;font-weight:700;color:#334155}
.placeholder-item .placeholder-badge{margin-left:auto;margin-right:7px;padding:2px 6px;border-radius:999px;background:#dcfce7;color:#15803d;font-size:9px;font-weight:800;letter-spacing:.02em}
.design-element.fit-content{white-space:nowrap}
.design-element.auto-height{height:auto!important;min-height:24px;white-space:pre-wrap}
.design-element.custom-text{white-space:pre-wrap}
.design-element.bank-field{white-space:pre-wrap}

/* Designer panel height, scrolling and typography controls */
@media (min-width:1181px){
  .designer-grid{--designer-panel-height:calc(100vh - 220px);align-items:stretch}
  .designer-panel,.canvas-panel{height:var(--designer-panel-height);min-height:640px;max-height:820px;box-sizing:border-box}
  .palette-panel{display:flex;flex-direction:column;overflow:hidden}
  .palette-panel .panel-heading{flex:0 0 auto}
  .placeholder-palette{min-height:0;overflow-y:auto;overscroll-behavior:contain;padding-right:5px;scrollbar-gutter:stable}
  .placeholder-palette::-webkit-scrollbar{width:8px}
  .placeholder-palette::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:999px}
  .placeholder-palette::-webkit-scrollbar-track{background:transparent}
  .canvas-panel{min-height:640px}
  .canvas-wrap{height:100%;min-height:0;display:flex;flex-direction:column}
  .page-stage{flex:1;min-height:0;max-height:none}
  .properties-panel{overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
}

#printPreview{white-space:nowrap}

.designer-actions{position:relative}.document-actions-menu{position:absolute;right:0;top:calc(100% + 8px);z-index:30;min-width:230px;padding:6px;background:#fff;border:1px solid #dbe2ea;border-radius:10px;box-shadow:0 14px 35px rgba(15,23,42,.16)}.document-actions-menu button{display:block;width:100%;border:0;background:transparent;text-align:left;padding:10px 12px;border-radius:7px;color:#172033;cursor:pointer}.document-actions-menu button:hover{background:#f3f6fa}.modal-backdrop{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px;background:rgba(15,23,42,.52)}.transfer-modal{width:min(480px,100%);background:#fff;border-radius:14px;padding:22px;box-shadow:0 24px 70px rgba(15,23,42,.28)}.transfer-modal h2{margin:0 0 8px}.transfer-modal>p{margin:0 0 18px;color:#64748b}.transfer-modal>label:not(.property-check){display:grid;gap:7px}.transfer-modal select{width:100%;padding:10px 12px;border:1px solid #cbd5e1;border-radius:8px;background:#fff}.transfer-overwrite{margin-top:14px}.transfer-warning{margin-top:12px;padding:10px 12px;border-radius:8px;background:#fff7ed;color:#9a3412;font-size:.9rem}.transfer-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
.modal-backdrop[hidden]{display:none}

.business-context-icon{display:flex;align-items:center;justify-content:center;background:#fff;overflow:hidden}.business-context-icon img{width:100%;height:100%;object-fit:contain;display:none}.business-context-icon #businessContextLogoFallback{width:100%;height:100%;display:grid;place-items:center;background:#2456d7;color:#fff;font-weight:800;font-size:13px;line-height:1}


/* Step 2: advanced line items table */
.design-element.line-items-table{display:block;padding:0;overflow:visible;border-color:#2563eb;background:rgba(255,255,255,.02)}
.line-items-grid{width:100%;height:100%;display:grid;grid-auto-rows:minmax(var(--row-height),auto);column-gap:0;row-gap:var(--row-gap);overflow:hidden;pointer-events:none}
.line-item-cell{min-width:0;overflow:hidden;padding:2px 4px;line-height:1.25;white-space:nowrap}
.line-item-description{white-space:normal}.line-item-description.no-wrap{white-space:nowrap}.line-item-description strong{display:block}.line-item-description span{display:block;margin-top:2px;font-size:.9em;font-weight:400;opacity:.82}
.table-column-guide{position:absolute;top:0;bottom:0;width:10px;transform:translateX(-5px);border:0;background:transparent;cursor:col-resize;z-index:5;padding:0}
.table-column-guide::before{content:"";position:absolute;left:4px;top:0;bottom:0;width:2px;background:#2563eb;box-shadow:0 0 0 1px rgba(255,255,255,.85)}
.table-column-guide:hover::before,.table-column-guide:focus::before{width:3px;left:3px;background:#1d4ed8}
.table-properties{display:grid;gap:12px;margin-bottom:14px}.table-properties[hidden]{display:none}.table-properties h3{margin:0;color:#1e293b}.table-help{margin:0;color:#64748b;font-size:12px;line-height:1.45}.table-properties fieldset{border:1px solid #e2e8f0;border-radius:10px;padding:10px;margin:0}.table-properties legend{padding:0 6px;font-size:12px;font-weight:800;color:#475569}.table-column-options{display:grid;grid-template-columns:1fr 1fr;gap:7px}.table-column-options .property-check{margin:0;padding:7px 8px}.table-column-options .property-check span{font-size:11px}.properties-panel:has(#tableProperties:not([hidden])) .designer-note{display:none}
@media(max-width:1180px){.table-column-options{grid-template-columns:repeat(4,1fr)}.table-properties{grid-column:1/-1}}
@media(max-width:780px){.table-column-options{grid-template-columns:1fr 1fr}}

/* Line items live preview, ordering, and contextual help */
.properties-title-row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.properties-question{width:28px;height:28px;border:1px solid #b8c7ea;border-radius:50%;background:#eef3ff;color:#2456d7;font-weight:800;font-size:15px;line-height:1;cursor:pointer;display:grid;place-items:center}
.properties-question:hover{background:#dfe8ff}.properties-question[hidden]{display:none}
.fieldset-help{margin:0 0 9px;color:#64748b;font-size:11px;line-height:1.4}
.table-column-order{display:grid;gap:6px}
.table-order-row{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 8px;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc;font-size:12px;font-weight:700;color:#334155}
.table-order-actions{display:flex;gap:5px}
.table-order-actions button{width:29px;height:27px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;color:#334155;font-weight:800;cursor:pointer}
.table-order-actions button:hover:not(:disabled){border-color:#7c9be8;color:#2456d7;background:#eef3ff}.table-order-actions button:disabled{opacity:.35;cursor:not-allowed}
.line-items-help-modal{z-index:120}
.help-modal-card{width:min(720px,calc(100vw - 32px));max-height:min(760px,calc(100vh - 32px));overflow:auto;background:#fff;border-radius:16px;padding:22px;box-shadow:0 24px 70px rgba(15,23,42,.28)}
.modal-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;border-bottom:1px solid #e2e8f0;padding-bottom:14px}.modal-header h2{margin:0;color:#1e293b}.modal-header p{margin:5px 0 0;color:#64748b;line-height:1.45}.modal-close{border:0;background:#f1f5f9;color:#475569;border-radius:9px;width:34px;height:34px;font-size:24px;cursor:pointer}
.help-modal-body{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:16px 0}.help-modal-body section{border:1px solid #e2e8f0;border-radius:11px;padding:13px;background:#f8fafc}.help-modal-body h3{margin:0 0 6px;font-size:14px;color:#1e293b}.help-modal-body p{margin:0;font-size:13px;line-height:1.5;color:#5b677a}.modal-actions{display:flex;justify-content:flex-end;border-top:1px solid #e2e8f0;padding-top:14px}
@media(max-width:620px){.help-modal-body{grid-template-columns:1fr}.help-modal-card{padding:16px}}

/* Published document workflow */
.documents-heading-line{display:flex;align-items:center;gap:10px}.page-help-button{width:28px;height:28px;border:1px solid #b8c7ea;border-radius:50%;background:#eef3ff;color:#2456d7;font-weight:800;font-size:15px;cursor:pointer;display:grid;place-items:center}.page-help-button:hover{background:#dfe8ff}.upload-layout.disabled{opacity:.48;cursor:not-allowed;pointer-events:none}.document-canvas.published-locked .design-element{cursor:default}.document-canvas.published-locked .design-element .resize-handle,.document-canvas.published-locked .table-column-guide{display:none}.document-canvas.published-locked .design-element.selected{outline-color:#16a34a;border-color:#16a34a}.publish-help-grid section{min-height:120px}.version-history-card{width:min(620px,calc(100vw - 32px));max-height:min(720px,calc(100vh - 32px));overflow:auto;background:#fff;border-radius:16px;padding:22px;box-shadow:0 24px 70px rgba(15,23,42,.28)}.version-history-list{display:grid;gap:10px;padding-top:16px}.version-row{display:flex;align-items:center;justify-content:space-between;gap:14px;border:1px solid #e2e8f0;border-radius:11px;padding:13px;background:#f8fafc}.version-row>div{display:grid;gap:4px}.version-row strong{color:#1e293b}.version-row span{font-size:12px;color:#64748b}.version-empty{color:#64748b;text-align:center;padding:28px}.design-status{white-space:nowrap}
body.embedded-document-designer .sidebar,body.embedded-document-designer .documents-topbar,body.embedded-document-designer .business-context,body.embedded-document-designer .document-type-tabs{display:none!important}body.embedded-document-designer .app-shell{display:block!important}body.embedded-document-designer .documents-main{margin:0!important;padding:0!important;width:100%!important;max-width:none!important}body.embedded-document-designer .documents-workspace{padding:14px!important}body.embedded-document-designer .designer-toolbar{margin-top:0!important}

/* Document Designer v2.4 — approved standalone workspace */
body.standalone-document-designer{margin:0;overflow:hidden;background:#f8fafc;color:#0f1f44;font-family:Inter,Arial,sans-serif}
body.standalone-document-designer .sidebar{display:none!important}
body.standalone-document-designer .documents-main{margin:0!important;width:100%!important;max-width:none!important;height:100vh;overflow:hidden;background:#f8fafc}
body.standalone-document-designer .documents-topbar{display:flex!important;position:relative;top:auto;min-height:72px;height:72px;padding:14px 24px;border-bottom:1px solid #dfe6f0;box-shadow:none;background:#fff}
body.standalone-document-designer .documents-title-row{gap:14px}
body.standalone-document-designer .documents-title-row h1{font-size:22px;line-height:1.1;font-weight:600;color:#111f43}
body.standalone-document-designer .documents-title-row p{font-size:12px;color:#65718a;margin-top:5px}
body.standalone-document-designer .sidebar-toggle{width:40px;height:40px;border:1px solid #dce4ef;border-radius:8px;background:#fff}
body.standalone-document-designer .documents-profile{gap:14px}
body.standalone-document-designer .documents-profile label{font-size:10px;color:#273451;text-transform:none}
body.standalone-document-designer .documents-profile select{min-width:145px;height:38px;border-radius:7px;font-size:12px;padding:0 34px 0 12px}
body.standalone-document-designer .documents-workspace{height:calc(100vh - 72px);padding:0 24px 12px;display:flex;flex-direction:column;overflow:hidden}
body.standalone-document-designer .business-context{display:none!important}
body.standalone-document-designer .document-type-tabs{display:flex!important;flex:0 0 54px;align-items:flex-end;gap:34px;margin:0;border-bottom:1px solid #dfe6f0;background:#fff}
body.standalone-document-designer .document-type-tabs button{height:54px;padding:0 4px 14px;border-bottom-width:2px;font-size:12px;font-weight:500;color:#26334e}
body.standalone-document-designer .document-type-tabs button.active{color:#0866ff;border-bottom-color:#0866ff}
body.standalone-document-designer .designer-toolbar{flex:0 0 58px;min-height:58px;margin:0 0 12px;padding:9px 12px;border-radius:8px;border-top:0;box-shadow:none}
body.standalone-document-designer .designer-toolbar b{font-size:12px;font-weight:600}
body.standalone-document-designer .design-status{font-size:10px;padding:4px 9px}
body.standalone-document-designer .designer-actions{gap:9px}
body.standalone-document-designer .designer-actions .soft-btn,body.standalone-document-designer .designer-actions .save-btn,body.standalone-document-designer .designer-actions .upload-layout{height:38px;padding:0 16px;border:1px solid #d9e2ef;border-radius:7px;background:#fff;color:#122044;font-size:12px;font-weight:600;box-shadow:none}
body.standalone-document-designer .designer-actions .upload-layout{color:#0866ff}
body.standalone-document-designer #publishDesign{background:#0866f5;color:#fff;border-color:#0866f5;padding-inline:24px;box-shadow:0 4px 12px rgba(8,102,245,.22)}
body.standalone-document-designer .document-actions-btn{min-width:86px}
body.standalone-document-designer .designer-grid{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:290px minmax(620px,1fr) 260px 74px;gap:10px;align-items:stretch}
body.standalone-document-designer .designer-panel,body.standalone-document-designer .canvas-panel{position:relative;top:auto;height:100%;min-height:0;max-height:none;padding:12px;border-radius:8px;border:1px solid #dfe6f0;box-shadow:none;background:#fff}
body.standalone-document-designer .palette-panel{display:flex;flex-direction:column;overflow:hidden}
body.standalone-document-designer .panel-heading h2{font-size:14px;font-weight:600;color:#172341}
body.standalone-document-designer .panel-heading p{font-size:11px;margin:4px 0 12px;color:#64718a}
.placeholder-search{position:relative;margin-bottom:12px}.placeholder-search img{position:absolute;left:11px;top:50%;width:14px;height:14px;transform:translateY(-50%);opacity:.65}.placeholder-search input{width:100%;height:36px;border:1px solid #dce4ef;border-radius:7px;padding:0 12px 0 34px;font-size:11px;color:#25324d;outline:none}.placeholder-search input:focus{border-color:#7aa8ff;box-shadow:0 0 0 3px rgba(8,102,245,.08)}
.placeholder-section-label{margin:2px 0 9px;font-size:9px;font-weight:600;color:#67728a;letter-spacing:.04em}
body.standalone-document-designer .placeholder-palette{gap:6px;overflow:auto;padding-right:2px}
body.standalone-document-designer .placeholder-item{min-height:36px;padding:7px 9px;border-radius:6px;border-color:#dfe6ef;font-size:11px;box-shadow:0 1px 2px rgba(15,31,68,.03)}
body.standalone-document-designer .placeholder-item::before{content:"";width:22px;height:22px;flex:0 0 22px;border-radius:6px;background:#eef4ff url('icons/placeholder.svg') center/12px no-repeat;margin-right:8px}
body.standalone-document-designer .placeholder-item span{margin-right:auto}
body.standalone-document-designer .placeholder-item small{font-size:0;width:12px;height:16px;background:radial-gradient(circle,#9aa6b8 1px,transparent 1.5px) 0 0/4px 4px}
body.standalone-document-designer .canvas-panel{padding:0;display:flex;overflow:hidden}
body.standalone-document-designer .canvas-wrap{width:100%;height:100%;display:flex;flex-direction:column;min-height:0}
.canvas-controls{height:48px;flex:0 0 48px;display:flex;align-items:center;gap:8px;padding:7px;border-bottom:1px solid #dfe6ef;background:#fff}
.canvas-control-group{display:flex;align-items:center;border:1px solid #dce4ef;border-radius:7px;overflow:hidden}.canvas-icon-control{min-width:36px;height:34px;border:0;border-right:1px solid #dce4ef;background:#fff;color:#1c2c4f;font-size:18px;cursor:pointer}.canvas-icon-control:last-child{border-right:0}.canvas-icon-control.active{background:#edf4ff;color:#0866f5}.canvas-icon-control:disabled{opacity:.4;cursor:not-allowed}.canvas-zoom-select{height:36px;border:1px solid #dce4ef;border-radius:7px;padding:0 28px 0 10px;background:#fff;color:#1c2c4f;font-size:11px}.grid-switch{margin-left:auto;display:flex;align-items:center;gap:8px;font-size:10px;color:#32405c;cursor:pointer}.grid-switch input{display:none}.grid-switch span{position:relative;width:28px;height:16px;border-radius:999px;background:#c7d0df;transition:.2s}.grid-switch span::after{content:"";position:absolute;width:12px;height:12px;left:2px;top:2px;border-radius:50%;background:#fff;transition:.2s}.grid-switch input:checked+span{background:#0866f5}.grid-switch input:checked+span::after{transform:translateX(12px)}
body.standalone-document-designer .canvas-ruler{height:28px;margin:0;padding:8px 14px 0 48px;background:#f9fbfe;border-bottom:1px solid #e7edf5;font-size:9px;color:#68768d;position:relative}.canvas-ruler::after{content:"0        50        100        150        200        250        300        350        400        450        500        550        600        650        700        750";position:absolute;left:48px;right:12px;top:8px;white-space:pre;word-spacing:17px;overflow:hidden}.canvas-ruler span{visibility:hidden}
body.standalone-document-designer .page-stage{flex:1;min-height:0;max-height:none;padding:14px 20px;background:#f5f7fb;border-radius:0;overflow:auto;align-items:flex-start}
body.standalone-document-designer .document-canvas{box-shadow:0 3px 14px rgba(17,31,67,.15)}
body.standalone-document-designer .document-canvas.show-grid{background-image:linear-gradient(rgba(8,102,245,.09) 1px,transparent 1px),linear-gradient(90deg,rgba(8,102,245,.09) 1px,transparent 1px);background-size:20px 20px}
body.standalone-document-designer .properties-panel{overflow:auto;padding:12px}
body.standalone-document-designer .properties-panel label{margin-bottom:10px}
body.standalone-document-designer .properties-panel label span{font-size:10px;margin-bottom:5px;color:#31405d}
body.standalone-document-designer .properties-panel input,body.standalone-document-designer .properties-panel select,body.standalone-document-designer .properties-panel textarea{min-height:36px;border-radius:7px;font-size:11px;border-color:#dce4ef}
body.standalone-document-designer .property-grid{gap:8px}
body.standalone-document-designer .danger-btn{height:38px;border-radius:7px;font-size:11px}
.designer-rail{height:100%;border:1px solid #dfe6f0;border-radius:8px;background:#fff;display:flex;flex-direction:column;align-items:stretch;padding:8px 6px;gap:4px}.designer-rail button{height:64px;border:0;border-radius:7px;background:#fff;color:#4b5870;font-size:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;cursor:pointer}.designer-rail button img{width:19px;height:19px;opacity:.75}.designer-rail button.active{color:#0866f5;background:#f3f7ff}.designer-rail button.active img{filter:invert(34%) sepia(95%) saturate(3798%) hue-rotate(211deg) brightness(100%) contrast(103%)}.designer-rail .rail-tips{margin-top:auto}
.designer-process-overlay{position:fixed;inset:0;z-index:3000;display:grid;place-items:center;background:rgba(246,249,253,.9);backdrop-filter:blur(4px)}.designer-process-overlay[hidden]{display:none}.designer-process-card{width:min(390px,calc(100vw - 40px));padding:34px;text-align:center;border:1px solid #dfe6f0;border-radius:16px;background:#fff;box-shadow:0 24px 70px rgba(16,31,67,.18)}.designer-process-spinner{width:44px;height:44px;margin:0 auto 18px;border:4px solid #dbe8ff;border-top-color:#0866f5;border-radius:50%;animation:documentUploadSpin .8s linear infinite}.designer-process-card h2{margin:0;color:#122044;font-size:20px}.designer-process-card p{margin:8px 0 18px;color:#69758b;font-size:13px}.designer-process-bar{height:7px;background:#e9eef6;border-radius:999px;overflow:hidden}.designer-process-bar span{display:block;width:40%;height:100%;background:#0866f5;border-radius:inherit;animation:documentUploadProgress 1.1s ease-in-out infinite}
@media(max-width:1280px){body.standalone-document-designer .designer-grid{grid-template-columns:240px minmax(520px,1fr) 240px 64px}.designer-rail button{height:58px}}
body.standalone-document-designer .page-stage.mobile-preview .canvas-scale-frame{margin-left:auto;margin-right:auto;max-width:390px;overflow:hidden;border-radius:12px;box-shadow:0 0 0 8px #111827}
body.standalone-document-designer .page-stage.mobile-preview .document-canvas{transform-origin:top center}

/* v2.5 — functional canvas controls and independent phone-layout view */
body.standalone-document-designer .document-canvas.show-grid::after{
  content:"";
  position:absolute;
  inset:0;
  z-index:1;
  pointer-events:none;
  background-image:
    linear-gradient(rgba(8,102,245,.16) 1px,transparent 1px),
    linear-gradient(90deg,rgba(8,102,245,.16) 1px,transparent 1px);
  background-size:20px 20px;
}
body.standalone-document-designer .document-canvas.show-grid .element-layer{z-index:2}
body.standalone-document-designer .document-canvas>img{z-index:0}
body.standalone-document-designer .page-stage.mobile-preview{
  background:linear-gradient(135deg,#eef2f7,#e4e9f1);
}
body.standalone-document-designer .page-stage.mobile-preview .canvas-scale-frame{
  border-radius:22px;
  box-shadow:0 0 0 8px #111827,0 18px 40px rgba(15,23,42,.24);
}
body.standalone-document-designer .page-stage.mobile-preview .document-canvas{
  border-radius:14px;
  overflow:hidden;
}
.canvas-zoom-select option[data-dynamic="1"]{font-weight:600}

/* v2.6 — advanced blank canvas, rulers, grid snapping, image and layer controls */
body.standalone-document-designer .canvas-panel{position:relative}
body.standalone-document-designer .canvas-wrap{display:flex!important}
body.standalone-document-designer .canvas-empty-hint{position:absolute;z-index:8;left:50%;top:150px;transform:translateX(-50%);width:360px;min-height:auto;padding:22px;border:1px dashed #cfd9e8;border-radius:12px;background:rgba(255,255,255,.94);pointer-events:auto}
body.standalone-document-designer .canvas-empty-hint[hidden]{display:none}
body.standalone-document-designer .page-stage{position:relative;padding:34px 24px 24px 50px}
body.standalone-document-designer .horizontal-ruler{padding-left:50px;background-color:#fafcff;background-image:repeating-linear-gradient(90deg,#c7d2e3 0 1px,transparent 1px 10px);background-size:auto 8px;background-position:50px bottom;background-repeat:repeat-x}
body.standalone-document-designer .horizontal-ruler::after{left:50px}
.vertical-ruler{position:absolute;left:0;top:0;bottom:0;width:30px;z-index:7;border-right:1px solid #dfe6f0;background:#fafcff repeating-linear-gradient(180deg,#c7d2e3 0 1px,transparent 1px 10px);background-size:8px auto;background-position:right 0;background-repeat:repeat-y;pointer-events:none}
.vertical-ruler::after{content:"0\A 50\A 100\A 150\A 200\A 250\A 300\A 350\A 400\A 450\A 500\A 550\A 600\A 650\A 700\A 750\A 800\A 850\A 900\A 950\A 1000\A 1050\A 1100";white-space:pre;position:absolute;top:3px;left:4px;font-size:8px;line-height:50px;color:#71809a}
.document-canvas.no-background{background-color:#fff;background-image:none}
.document-canvas.no-background::before{content:"";position:absolute;inset:0;border:1px solid #dfe6ef;pointer-events:none;z-index:0}
.document-canvas.show-grid::after{display:block!important;background-image:linear-gradient(rgba(8,102,245,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(8,102,245,.18) 1px,transparent 1px)!important;background-size:20px 20px!important}
.add-image-layer{height:38px;margin-top:10px;border:1px dashed #9fb9e6;border-radius:7px;background:#f7faff;color:#0866f5;font-size:11px;font-weight:600;cursor:pointer}
.design-element.image-layer{padding:0;background:transparent;border-color:#4d8dff;overflow:visible}
.design-element.image-layer img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;user-select:none}
.design-element.layer-locked{cursor:not-allowed}
.layers-panel{position:absolute;right:84px;top:0;bottom:0;z-index:40;width:310px;padding:12px;border:1px solid #dfe6ef;border-radius:8px;background:#fff;box-shadow:0 14px 38px rgba(15,31,68,.16);overflow:hidden}
.layers-panel[hidden]{display:none}
.layers-panel-head{display:flex;align-items:flex-start;justify-content:space-between;padding-bottom:10px;border-bottom:1px solid #e6ebf3}
.layers-panel-head h2{margin:0;font-size:14px;color:#172341}.layers-panel-head p{margin:4px 0 0;font-size:10px;color:#6b7890}.layers-panel-head button{width:30px;height:30px;border:0;background:#f4f7fb;border-radius:7px;font-size:20px;cursor:pointer}
.layers-list{display:flex;flex-direction:column;gap:6px;height:calc(100% - 66px);padding-top:10px;overflow:auto}
.layer-row{display:grid;grid-template-columns:minmax(0,1fr) 30px 30px 30px;align-items:center;gap:4px;min-height:42px;padding:4px;border:1px solid #e0e7f1;border-radius:7px;background:#fff;cursor:grab}
.layer-row.active{border-color:#7aa8ff;background:#f4f8ff}.layer-row button{height:30px;border:0;border-radius:5px;background:transparent;color:#34415d;cursor:pointer}.layer-row button:hover{background:#eef3fb}
.layer-select{display:flex;align-items:center;gap:8px;min-width:0;text-align:left}.layer-select span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.layer-kind{display:grid;place-items:center;width:26px;height:24px;border-radius:5px;background:#edf4ff;color:#0866f5;font-size:8px;font-weight:700}
.layer-delete{font-size:18px;color:#dc3545!important}.layers-empty{padding:28px 12px;text-align:center;color:#7a879c;font-size:11px}
#propColor{height:38px;padding:4px;cursor:pointer}
@media(max-width:1280px){.layers-panel{right:72px;width:280px}}

/* v2.7 — unified inspector, background layer, inline history and approved text-style controls */
.drop-overlay[hidden],.upload-busy[hidden]{display:none!important}
body.standalone-document-designer .designer-grid{position:relative}
body.standalone-document-designer .properties-panel,
body.standalone-document-designer .inspector-panel{grid-column:3;grid-row:1;min-width:0;height:100%;max-height:none;overflow:auto}
body.standalone-document-designer .properties-panel[hidden],
body.standalone-document-designer .inspector-panel[hidden]{display:none!important}
body.standalone-document-designer .layers-panel,
body.standalone-document-designer .history-inspector-panel{position:relative;inset:auto;right:auto;top:auto;bottom:auto;z-index:1;width:auto;padding:12px;box-shadow:none;border:1px solid #dfe6ef;border-radius:8px;background:#fff}
.layers-panel-head{min-height:48px}
.layers-panel-head>button{display:none}
.layers-list{height:calc(100% - 58px)}
.layer-row{transition:border-color .15s,background .15s,transform .15s}
.layer-row.drag-over{border-color:#0866f5;background:#edf4ff;transform:translateY(2px)}
.background-layer-row{margin-top:auto;background:#fafbfd;border-style:dashed}
.background-layer-row .layer-kind{background:#eef1f5;color:#5f6d83}
.background-layer-row .layer-lock,.background-layer-row .layer-delete{opacity:.35;cursor:not-allowed}
.history-inspector-list{display:flex;flex-direction:column;gap:7px;height:calc(100% - 58px);padding-top:10px;overflow:auto}
.history-state-row{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:44px;padding:8px 10px;border:1px solid #e0e7f1;border-radius:8px;background:#fff;color:#172341;text-align:left;cursor:pointer}
.history-state-row small{color:#728097;font-size:10px}
.history-state-row:hover{background:#f7faff;border-color:#bfd3f5}
.history-state-row.active{border-color:#7aa8ff;background:#edf4ff}
.text-style-editor{margin:4px 0 14px;padding-top:2px}
.text-style-editor[hidden]{display:none!important}
.text-style-editor h3{margin:0 0 8px;font-size:11px;font-weight:600;color:#1c2c4f}
.text-style-main{display:grid;grid-template-columns:minmax(0,1fr) 62px 42px;gap:7px;align-items:end}
.text-style-main label{margin:0!important}
.text-style-main label>span{display:block;margin-bottom:5px;font-size:9px!important;color:#68768d!important}
.text-style-main select,.text-style-main input[type=number]{width:100%;height:36px!important;min-height:36px!important}
.text-color-control input[type=color]{width:42px!important;height:36px!important;min-height:36px!important;padding:4px!important;border:1px solid #dce4ef;border-radius:7px;background:#fff}
.text-style-buttons{display:flex;align-items:center;gap:0;margin-top:8px}
.text-style-buttons button{width:38px;height:34px;border:1px solid #dce4ef;border-right:0;background:#fff;color:#2b3955;font-size:16px;cursor:pointer}
.text-style-buttons button:first-child{border-radius:7px 0 0 7px}
.text-style-buttons button:nth-child(3){border-right:1px solid #dce4ef;border-radius:0 7px 7px 0}
.text-style-buttons button:nth-of-type(4){margin-left:8px;border-left:1px solid #dce4ef;border-radius:7px 0 0 7px}
.text-style-buttons button:last-child{border-right:1px solid #dce4ef;border-radius:0 7px 7px 0}
.text-style-buttons button.active{background:#edf4ff;color:#0866f5;box-shadow:inset 0 0 0 1px #86b1ff}
.text-style-buttons #alignLeft,.text-style-buttons #alignCenter,.text-style-buttons #alignRight{font-family:Arial,sans-serif;font-size:20px;line-height:1;overflow:hidden}
.text-style-buttons #alignLeft{text-align:left;padding-left:9px}
.text-style-buttons #alignCenter{text-align:center}
.text-style-buttons #alignRight{text-align:right;padding-right:9px}
.text-style-divider{width:1px;height:24px;margin:0 8px;background:#e5eaf2}
.background-properties{display:flex;flex-direction:column;gap:12px}
.background-properties[hidden]{display:none!important}
.background-properties label{margin:0!important}
.background-opacity-row{display:grid;grid-template-columns:minmax(0,1fr) 46px;align-items:center;gap:9px}
.background-opacity-row input[type=range]{min-height:auto!important;height:18px!important;padding:0!important;border:0!important}
.background-opacity-row output{font-size:11px;color:#43516b;text-align:right}
.background-help{margin:0;padding:10px;border-radius:7px;background:#f7f9fc;color:#6d7a91;font-size:10px;line-height:1.45}
#layoutPreview{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;transition:opacity .15s}
.element-layer{position:absolute;inset:0;z-index:auto;pointer-events:none}
.design-element{pointer-events:auto}
.document-canvas.show-grid::after{z-index:999999!important}
.element-layer{z-index:2}
#layoutPreview{z-index:0}
@media(max-width:1280px){body.standalone-document-designer .layers-panel,body.standalone-document-designer .history-inspector-panel{right:auto;width:auto}}


/* v2.8 — true layer stack, blank-canvas editing and complete preview output */
body.standalone-document-designer .canvas-empty-hint{pointer-events:none}
body.standalone-document-designer .canvas-empty-hint .upload-layout{pointer-events:auto}
body.standalone-document-designer .element-layer{z-index:auto!important}
body.standalone-document-designer #layoutPreview{z-index:0}
body.standalone-document-designer .document-canvas.show-grid::after{z-index:2147483646!important}
body.standalone-document-designer .layers-list{justify-content:flex-start;height:calc(100% - 58px);overflow-y:auto;overflow-x:hidden;padding-bottom:10px}
body.standalone-document-designer .background-layer-row{margin-top:0;background:#fafbfd;border-style:solid}
body.standalone-document-designer .layer-row.dragging{opacity:.45}
body.standalone-document-designer .layer-row[draggable="true"]{cursor:grab}
body.standalone-document-designer .layer-row[draggable="true"]:active{cursor:grabbing}
body.standalone-document-designer .layer-row .layer-select{cursor:pointer}
body.standalone-document-designer .layer-row .layer-delete:disabled{opacity:.3;cursor:not-allowed}
body.standalone-document-designer .empty-canvas.canvas-empty-hint{max-width:360px}

/* v8.4.1 — stable canvas, direct palette drag, and deterministic layer ordering */
.palette-drag-ghost{position:fixed;z-index:100000;pointer-events:none;padding:8px 12px;border:1px solid #2563eb;border-radius:8px;background:#fff;color:#173b9b;font-size:12px;font-weight:700;box-shadow:0 10px 30px rgba(37,99,235,.22)}
.document-canvas.palette-drop-target{outline:3px solid rgba(37,99,235,.45);outline-offset:3px}
.layer-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto auto;align-items:center}
.layer-drag-handle{display:grid;place-items:center;width:22px;height:28px;color:#94a3b8;cursor:grab;user-select:none;font-size:12px;letter-spacing:-2px}
.layer-drag-handle:active{cursor:grabbing}.layer-row.dragging{opacity:.48}.layer-row.drag-over{border-color:#2563eb;background:#eff6ff;box-shadow:inset 0 2px 0 #2563eb}
.background-layer-row{grid-template-columns:minmax(0,1fr) auto auto auto}.background-layer-row .layer-select{padding-left:8px}.background-layer-row .layer-lock{cursor:default}
.background-actions{display:grid;gap:8px}.background-actions .danger-btn{margin:0}
.document-canvas>img{object-fit:fill}

/* v2.9: reliable pointer-driven placeholder drag */
.placeholder-item{touch-action:none;-webkit-user-drag:none;user-select:none}
.placeholder-item *{pointer-events:none}

/* v3.0 — custom shape layers */
.palette-add-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}
.palette-add-actions .add-image-layer,.palette-add-actions .add-shape-layer{height:38px;margin:0;border:1px dashed #9fb9e6;border-radius:7px;background:#f7faff;color:#0866f5;font-size:11px;font-weight:600;cursor:pointer}
.palette-add-actions button:hover{background:#edf4ff;border-color:#6f9fe8}
.design-element.shape-layer{padding:0;background:transparent;overflow:visible}
.shape-visual{position:absolute;inset:0;width:100%;height:100%;box-sizing:border-box;pointer-events:none}
.shape-visual svg{display:block;width:100%;height:100%;overflow:visible}
.shape-properties{display:flex;flex-direction:column;gap:11px;margin:4px 0 14px;padding-top:2px}
.shape-properties[hidden]{display:none!important}
.shape-properties h3{margin:0 0 2px;font-size:11px;font-weight:600;color:#1c2c4f}
.shape-properties label{margin:0!important}
.shape-properties label>span{display:block;margin-bottom:5px;font-size:9px;color:#68768d}
.shape-color-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.shape-color-grid input[type=color]{width:100%;height:38px;min-height:38px;padding:4px;border:1px solid #dce4ef;border-radius:7px;background:#fff;cursor:pointer}
.shape-properties fieldset{margin:0;padding:10px;border:1px solid #e1e7f0;border-radius:8px;background:#fafbfd}
.shape-properties legend{padding:0 5px;font-size:10px;font-weight:600;color:#34415d}
.layer-kind{flex:0 0 auto}

/* v3.1 — shape transforms, right triangle and Google font controls */
.shape-visual{transform-origin:center center;will-change:transform}
.shape-transform-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;align-items:end;margin-top:10px}
.shape-transform-grid>label,.shape-transform-grid>div{margin:0}
.shape-transform-grid span{display:block;margin-bottom:5px;font-size:10px;font-weight:600;color:#53627a}
.rotation-input{position:relative}.rotation-input input{padding-right:28px!important}.rotation-input em{position:absolute;right:11px;top:50%;transform:translateY(-50%);font-style:normal;color:#6f7d92}
.shape-flip-buttons{display:grid;grid-template-columns:1fr 1fr;gap:6px}.shape-flip-buttons button{height:38px;border:1px solid #dce4ef;border-radius:7px;background:#fff;color:#263653;font-size:18px;cursor:pointer}.shape-flip-buttons button:hover{background:#f5f8fd}.shape-flip-buttons button.active{border-color:#86b1ff;background:#edf4ff;color:#0866f5}
#propFontFamily option{font-family:inherit}
