@font-face{font-family:Inter;src:url('../fonts/inter/Inter-Variable-Latin.woff2') format('woff2');font-display:swap}:root{--d-bg:#f3f6fa;--d-panel:#fff;--d-text:#172b4d;--d-muted:#586b82;--d-border:#dce4ef;--d-accent:#185fa5;--d-soft:#edf4fc;color-scheme:light}html.viya-dv,html[data-theme=dark]{--d-bg:#091321;--d-panel:#111f33;--d-text:#edf3fc;--d-muted:#a9bad0;--d-border:#30445f;--d-accent:#8bc4ff;--d-soft:#1a304b;color-scheme:dark}*{box-sizing:border-box}body.invoice-designer{margin:0;background:var(--d-bg)!important;color:var(--d-text)!important;font:14px/1.5 Inter,system-ui,sans-serif}main{max-width:1680px;margin:auto;padding:30px 32px 150px}button,input,select{font:inherit}button,select{border:1px solid var(--d-border);border-radius:9px;background:var(--d-panel);color:var(--d-text);padding:10px 13px;min-height:42px}button{cursor:pointer;font-weight:650}button:hover{background:var(--d-soft)}button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #4995e0;outline-offset:3px}button:disabled{opacity:.55;cursor:wait}a{color:var(--d-accent);font-weight:650;text-decoration:none}h1{font-size:30px;letter-spacing:-.8px;line-height:1.2;margin:6px 0 10px}h2{font-size:17px;margin:0}h3{font-size:13px;margin:22px 0 12px}.hint,.quiet p,.sub{color:var(--d-muted)}.sub{margin:0;font-size:15px}.hint{font-size:12px;margin:14px 0 0}.eyebrow{font-size:10px;letter-spacing:1.8px;font-weight:750;color:var(--d-muted);margin:25px 0 10px}.designer-head{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:28px}.business-chip{padding:8px 14px;background:var(--d-soft);border:1px solid var(--d-border);border-radius:30px;font-size:12px}.designer-grid{display:grid;grid-template-columns:360px minmax(0,1fr);gap:24px;align-items:start}.controls,.preview-panel{min-width:0}.panel{background:var(--d-panel);border:1px solid var(--d-border);border-radius:14px;padding:22px;margin-bottom:16px}.panel-title{display:flex;gap:10px;align-items:center;margin-bottom:18px}.step{font-size:10px;color:var(--d-accent);background:var(--d-soft);padding:5px 7px;border-radius:6px;font-weight:750}.template-cards{display:grid;grid-template-columns:1fr 1fr;gap:12px}.template-card{padding:9px;text-align:left;font-size:12px}.template-card[aria-pressed=true]{border:2px solid var(--d-accent);padding:8px;background:var(--d-soft)}.template-thumbnail{display:block;background:#fff;border:1px solid #dce4ef;aspect-ratio:1.4;position:relative;margin-bottom:8px;padding:12px 10px;color:#172b4d;border-radius:5px;overflow:hidden}.mini-head{display:block;height:13px;width:100%;background:#185fa5;margin-bottom:10px}.mini-line{display:block;height:3px;background:#dbe4ef;margin:5px 0}.mini-line:nth-child(3){width:65%}.mini-total{display:block;width:40%;height:7px;background:#185fa5;margin:8px 0 0 auto}.template-card[data-template=minimal] .mini-head{height:2px}.template-card[data-template=professional] .mini-head{height:20px;background:#172b4d}.template-card[data-template=modern] .mini-head{border-radius:7px}.presets{display:flex;gap:9px;flex-wrap:wrap}.preset{padding:0;width:32px;min-height:32px;border:3px solid var(--d-panel);outline:1px solid var(--d-border);border-radius:50%;background:var(--swatch)!important}.color-fields{display:grid;gap:10px;margin-top:18px}.color-row{display:grid;grid-template-columns:1fr 34px 93px;gap:8px;align-items:center;font-size:12px}.color-row input[type=color]{width:34px;height:34px;padding:2px;border:1px solid var(--d-border);border-radius:7px;background:var(--d-panel)}.color-row input[type=text]{min-width:0;width:100%;padding:7px;border:1px solid var(--d-border);border-radius:7px;background:var(--d-panel);color:var(--d-text);font-size:12px}.image-control{border:1px dashed var(--d-border);padding:12px;border-radius:10px;margin-top:12px}.image-label{font-size:12px;font-weight:700;display:flex;justify-content:space-between;align-items:center}.image-preview{width:100%;height:58px;object-fit:contain;background:repeating-conic-gradient(#fff 0 25%,#eef2f6 0 50%) 50%/12px 12px;border-radius:6px;margin:8px 0}.image-control input{max-width:100%;font-size:11px}.image-control button{min-height:30px;font-size:11px;padding:4px 8px}.visibility{display:grid;gap:11px}.visibility label{display:flex;justify-content:space-between;gap:12px;font-size:12px}.visibility input{accent-color:#185fa5;width:17px;height:17px;margin:0}.text-button{color:var(--d-accent);padding:0;border:0;background:0 0;min-height:40px;text-align:left}.quiet h3{margin-top:0}.quiet p{font-size:12px}.preview-panel{position:sticky;top:18px;border:1px solid var(--d-border);border-radius:14px;overflow:hidden;background:var(--d-panel)}.preview-toolbar{padding:16px 20px;display:flex;gap:12px;justify-content:space-between;align-items:center;border-bottom:1px solid var(--d-border)}.sample-label{display:block;color:var(--d-muted);font-size:11px}.preview-tools{display:flex;gap:6px;align-items:center}.preview-tools button,.preview-tools select{min-height:34px;padding:5px 9px;font-size:12px}.preview-tools output{font-size:11px;min-width:30px;text-align:center}.preview-viewport{background:var(--d-soft);padding:24px;overflow:auto;max-height:calc(100vh - 250px);min-height:440px}#previewSizer{margin:auto;position:relative}#invoicePreview{display:block;border:0;width:794px;height:1123px;transform-origin:top left;background:#fff;box-shadow:0 8px 30px #13284820}.preview-caption{text-align:center;font-size:11px;color:var(--d-muted);padding:12px}.designer-actions{position:fixed;bottom:0;left:0;right:0;padding:15px 32px max(15px,env(safe-area-inset-bottom));background:var(--d-panel);border-top:1px solid var(--d-border);display:flex;justify-content:space-between;align-items:center;gap:16px;z-index:10;box-shadow:0 -4px 20px #14213a09}.designer-actions strong{display:block;font-size:13px}.designer-actions span{font-size:11px;color:var(--d-muted)}.action-buttons{display:flex;gap:8px;flex-wrap:wrap}.primary{background:#185fa5!important;color:#fff!important;border-color:#185fa5}#designerMessage:not(:empty){padding:12px 16px;background:var(--d-soft);border:1px solid var(--d-border);border-radius:10px;margin-bottom:16px}#designerMessage[data-error=true]{border-color:#d66b6b}dialog{background:var(--d-panel);color:var(--d-text);border:1px solid var(--d-border);border-radius:16px;padding:26px;max-width:440px;width:calc(100% - 32px)}dialog::backdrop{background:#071426aa}.dialog-actions{display:flex;justify-content:flex-end;gap:10px}@media(max-width:1100px){main{padding:24px 20px 150px}.designer-grid{grid-template-columns:300px minmax(0,1fr);gap:16px}.panel{padding:17px}.preview-toolbar{align-items:flex-start;flex-direction:column}.designer-actions>div:first-child{display:none}.designer-actions{justify-content:flex-end;padding-inline:20px}}@media(max-width:700px){main{padding:20px 14px 190px}h1{font-size:25px}.designer-head{align-items:flex-start;flex-direction:column;gap:12px}.designer-grid{grid-template-columns:minmax(0,1fr)}.preview-panel{position:static}.preview-viewport{min-height:350px;max-height:70vh;padding:14px}.preview-toolbar{padding:14px}.designer-actions{padding:10px 14px max(10px,env(safe-area-inset-bottom))}.action-buttons{display:grid;grid-template-columns:1fr 1fr;width:100%;gap:7px}.action-buttons button{font-size:12px;min-height:38px;padding:8px}.action-buttons #pdfTemplate{grid-column:1/-1}.color-row input[type=text],select{font-size:16px}.designer-head .eyebrow{margin-top:20px}}html body.invoice-designer .controls button.preset{background:var(--swatch)!important;border:2px solid var(--d-border)!important}html body.invoice-designer .template-card[aria-pressed=true]{border-color:var(--d-accent)!important;background:var(--d-soft)!important}.template-gallery .template-cards{grid-template-columns:repeat(6,minmax(0,1fr));gap:14px}.template-gallery .template-card{padding:10px;min-width:0}.template-gallery .template-thumbnail{width:100%;height:auto;aspect-ratio:240/340;padding:0;border-radius:5px}.template-label{display:block;font-size:14px}.template-description{display:block;color:var(--d-muted);font-weight:400;font-size:11px;margin-top:3px}.editor-label{display:block;font-size:12px;font-weight:650;margin:16px 0 6px}#templateFont,#templateFooter{width:100%;background:var(--d-panel);color:var(--d-text);border:1px solid var(--d-border);border-radius:8px;padding:10px;font:inherit}#templateFooter{resize:vertical;min-height:90px}#saveConfirmation{max-width:430px}#saveConfirmation h2{font-size:20px}#saveConfirmation button{float:right}@media(max-width:1100px){.template-gallery .template-cards{grid-template-columns:repeat(3,minmax(0,1fr))}.template-gallery .template-thumbnail{max-height:255px}}@media(max-width:700px){.template-gallery .template-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.template-label{font-size:13px}#templateFont,#templateFooter{font-size:16px}.template-gallery .template-description{font-size:10px}}body.invoice-designer .main-content{min-width:0;flex:1;max-width:none;margin:0}@media(min-width:1025px){body.invoice-designer .designer-actions{left:var(--vb-sidebar-w,220px)}}@media(max-width:1024px){body.invoice-designer .designer-actions{left:0}}body.invoice-designer .designer-head{margin-bottom:18px;gap:16px}body.invoice-designer .designer-head h1{font-size:26px}body.invoice-designer .eyebrow{display:none}body.invoice-designer .template-gallery{padding:18px}body.invoice-designer .template-cards{display:flex;gap:10px;overflow-x:auto;padding:4px 2px 12px;scroll-snap-type:x proximity}body.invoice-designer .template-card{flex:0 0 130px;scroll-snap-align:start;position:relative}body.invoice-designer .template-thumbnail{height:130px;width:100%;object-fit:contain;aspect-ratio:auto}body.invoice-designer .template-label{font-size:13px;margin-top:8px}body.invoice-designer .template-description{font-size:11px;line-height:1.35;min-height:30px}body.invoice-designer .template-card[aria-pressed=true]::after{content:'✓';position:absolute;top:5px;right:5px;background:#185fa5;color:#fff;border-radius:50%;width:22px;height:22px;text-align:center}body.invoice-designer .template-import{border:1px dashed var(--d-border);border-radius:12px;padding:14px 16px;background:var(--d-soft);margin-bottom:14px}body.invoice-designer .template-import label{display:block;margin-bottom:8px}body.invoice-designer input[type=file]{display:block;width:100%;max-width:100%;font-size:12px;overflow:hidden;color:var(--d-muted)}body.invoice-designer input[type=file]::file-selector-button{border:1px solid var(--d-border);background:var(--d-panel);color:var(--d-text);padding:10px 14px;border-radius:8px;margin-right:12px;cursor:pointer;font-weight:600}body.invoice-designer .hint{line-height:1.5}body.invoice-designer #templateImportStatus:empty{display:none}body.invoice-designer #templateImportStatus{overflow-wrap:anywhere;font-size:13px}body.invoice-designer .designer-grid{grid-template-columns:300px minmax(0,1fr);align-items:start;gap:20px}body.invoice-designer .designer-section{margin-top:16px;border-top:1px solid var(--d-border);padding-top:14px}body.invoice-designer .designer-section summary{cursor:pointer;font-weight:650;font-size:14px;min-height:32px;color:var(--d-text)}body.invoice-designer .designer-section[open] summary{margin-bottom:14px}body.invoice-designer .image-preview{width:100%;height:88px;max-height:88px;object-fit:contain;background:var(--d-soft)}body.invoice-designer .preview-panel{position:sticky;top:76px;align-self:start}body.invoice-designer .preview-viewport{max-height:calc(100dvh - 240px);min-height:320px;padding:20px}body.invoice-designer .preview-toolbar{padding:12px 16px;flex-wrap:wrap}body.invoice-designer .designer-actions{padding:12px 20px;gap:10px}body.invoice-designer .designer-actions [hidden]{display:none!important}body.invoice-designer #referenceCropControls{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:12px 0}body.invoice-designer #referenceCropControls input{width:100%;padding:8px;border:1px solid var(--d-border);border-radius:8px;background:var(--d-panel);color:var(--d-text)}@media(max-width:1100px){body.invoice-designer .designer-grid{grid-template-columns:260px minmax(0,1fr)}}@media(max-width:700px){body.invoice-designer .designer-grid{grid-template-columns:minmax(0,1fr)}body.invoice-designer .preview-panel{position:static}body.invoice-designer .template-card{flex-basis:116px}body.invoice-designer .template-thumbnail{height:110px}body.invoice-designer .designer-actions .action-buttons{display:grid;grid-template-columns:1fr 1fr}body.invoice-designer .action-buttons #pdfTemplate{grid-column:auto}body.invoice-designer .preview-tools{flex-wrap:wrap}body.invoice-designer .main-content{padding-bottom:170px!important}body.invoice-designer .template-import{padding:12px}body.invoice-designer #referenceCropControls{grid-template-columns:1fr 1fr}}body.invoice-designer #invoicePreview{width:794px!important;max-width:none!important;min-width:794px!important}body.invoice-designer #previewSizer{max-width:none!important}body.invoice-designer .image-preview{background-color:#fff;background-image:linear-gradient(45deg,#edf0f4 25%,transparent 25%),linear-gradient(-45deg,#edf0f4 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#edf0f4 75%),linear-gradient(-45deg,transparent 75%,#edf0f4 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0}@media(max-width:700px){body.invoice-designer:has(.viya-bottom-nav) .designer-actions{bottom:calc(64px + env(safe-area-inset-bottom))}body.invoice-designer .main-content{padding-bottom:250px!important}}body.invoice-designer .custom-editor{margin:18px 0}body.invoice-designer .custom-editor label{display:block;margin:12px 0}body.invoice-designer .custom-editor input:not([type=checkbox]),body.invoice-designer .custom-editor select{padding:9px;width:100%;max-width:420px;border:1px solid var(--d-border);border-radius:8px;background:var(--d-panel);color:var(--d-text)}body.invoice-designer .custom-crop-fields,body.invoice-designer .custom-position-fields{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}body.invoice-designer .custom-map{position:relative;width:100%;max-width:420px;aspect-ratio:210/297;border:1px solid #b6c5d8;background:#fff;margin:18px 0}body.invoice-designer .custom-map button{position:absolute;font-size:10px;min-height:0;padding:2px;border:1px solid #185fa5;background:#e8f2ff;color:#123459;border-radius:2px;touch-action:none;overflow:hidden}body.invoice-designer .custom-map button[aria-pressed=true]{outline:2px solid #185fa5;background:#c9e2ff}@media(max-width:700px){body.invoice-designer .custom-crop-fields,body.invoice-designer .custom-position-fields{grid-template-columns:1fr 1fr}}