:root{--primary:#0f172a;--accent:#0f766e;--bg:#f1f5f9;--border:#dce4ec;--text:#334155}*{box-sizing:border-box}body{margin:0;font-family:'Plus Jakarta Sans',Arial,sans-serif;background:var(--bg);color:var(--text);font-size:14px}button,input,textarea,select{font:inherit}button{cursor:pointer}button:disabled{opacity:.6;cursor:wait}[hidden]{display:none!important}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}.top-nav{background:#fff;padding:16px 28px;display:flex;justify-content:space-between;align-items:center;gap:16px;border-bottom:1px solid var(--border);flex-wrap:wrap}.logo{font-size:20px;font-weight:700;text-decoration:none;color:var(--primary)}.logo span{color:var(--accent)}.nav-actions{display:flex;align-items:center;gap:12px}.btn{padding:10px 14px;border:1px solid transparent;border-radius:7px;font-weight:600;text-decoration:none;font-size:13px;display:inline-block}.btn-primary{background:var(--accent);color:white}.btn-outline{background:white;border-color:var(--border);color:var(--text)}.btn-block{width:100%;display:block;margin-top:10px}.container{max-width:1220px;margin:24px auto;display:flex;gap:24px;padding:0 20px;align-items:flex-start}.invoice-wrapper{--document-accent:#0f766e;flex:1;min-width:0;background:white;box-shadow:0 4px 20px #0f172a0a;padding:28px;border-radius:9px;color:#263647}.invoice-header{display:flex;justify-content:space-between;gap:20px;margin-bottom:20px;align-items:flex-start}.logo-upload{width:150px;height:88px;border:1px dashed var(--border);display:flex;align-items:center;justify-content:center;border-radius:6px;color:#64748b;font-size:12px;text-align:center;flex-shrink:0;cursor:pointer}.logo-upload img{width:100%;height:100%;object-fit:contain}.invoice-title{color:var(--document-accent);font-size:30px;letter-spacing:1px;margin:0 0 8px;text-align:right;overflow-wrap:anywhere}.invoice-meta{display:flex;flex-direction:column;gap:4px}.meta-row{display:flex;align-items:center;gap:8px;justify-content:flex-end;font-size:12px}.meta-row>span{min-width:60px;text-align:right;color:#64748b}.meta-row .input-plain{width:165px;text-align:right;font-size:12px}.input-plain{font-size:13px;font-family:inherit;border:1px solid transparent;border-radius:4px;background:transparent;color:inherit;padding:5px 6px;width:100%;min-width:0}.input-plain:focus,.input-plain:hover{border-color:var(--border);outline-color:var(--accent);background:#f8fafc}textarea.input-plain{resize:none;min-height:30px;overflow:hidden;line-height:1.5}.business-name{font-weight:700;font-size:15px}.addresses{display:grid;grid-template-columns:1fr 1fr;gap:24px;margin-bottom:16px}.address-box{min-width:0}.address-title{color:#64748b;font-size:10px;text-transform:uppercase;letter-spacing:1px;margin:0 0 5px}.items-scroll{width:100%;overflow-x:auto}.items-table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:12px;margin:0}.items-table th{font-size:10px;text-transform:uppercase;text-align:left;padding:9px 5px;color:var(--document-accent);border-bottom:2px solid var(--document-accent)}.items-table td{border-bottom:1px solid var(--border);padding:6px 4px;vertical-align:top;overflow-wrap:anywhere}.items-table .input-plain{font-size:12px;padding:4px 2px}.col-name{width:43%}.col-qty{width:12%}.col-price{width:20%}.col-total{width:25%;text-align:right!important}.col-action{width:27px}.btn-remove{background:#fee2e2;color:#b91c1c;border:0;border-radius:4px;width:23px;height:23px}.btn-add-item{padding:12px 0;color:var(--document-accent);background:none;border:0;font-size:12px;font-weight:700}.totals{width:365px;max-width:100%;margin:12px 0 0 auto;font-size:12px}.total-row{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:6px 0}.total-row>span:last-child,.total-row>strong:last-child{white-space:nowrap}.total-row label{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:11px}.money-input{width:82px;text-align:right;border-color:var(--border);padding:3px}.total-amount{border-top:1px solid var(--border);margin-top:4px}.grand-total{border-top:2px solid var(--document-accent);font-size:15px;color:var(--document-accent);margin-top:6px;padding-top:10px}.document-bottom{display:flex;justify-content:space-between;align-items:flex-end;gap:24px;margin-top:20px}.notes-section{flex:1;min-width:0}.signature-section{width:180px;flex-shrink:0;text-align:center}.signature-section img{width:100%;height:65px;object-fit:contain;display:block;margin-bottom:4px}.signature-caption{border-top:1px solid var(--border);font-size:10px;color:#64748b;padding-top:6px}.signature-section .input-plain{text-align:center;font-size:12px}.payment-status{text-align:right;font-size:10px;color:var(--document-accent);font-weight:700;margin-top:8px;letter-spacing:1px}.sidebar{width:285px;flex-shrink:0;display:flex;flex-direction:column;gap:16px}.tool-card{background:white;border:1px solid var(--border);padding:20px;border-radius:9px}.tool-title{margin:0 0 16px;color:var(--primary);font-size:16px}.form-group{margin-bottom:15px}.form-group label{display:block;font-size:12px;font-weight:600;margin-bottom:6px}.form-control{width:100%;padding:9px;border:1px solid var(--border);border-radius:6px;background:white;min-width:0}.form-group small,.help-text{font-size:11px;line-height:1.6;color:#64748b}.help-text{margin:0 0 16px}.artwork-actions{display:flex;flex-wrap:wrap;gap:6px}.artwork-actions .btn{font-size:10px;padding:7px}.document-error{font-size:12px;line-height:1.5;color:#b91c1c;background:#fef2f2;padding:10px;border-radius:6px}#loadingOverlay{position:fixed;inset:0;background:#ffffffeb;z-index:999;display:none;align-items:center;justify-content:center;flex-direction:column;gap:15px}.spinner{width:32px;height:32px;border:3px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}
[data-template=modern] .invoice-header{border-top:6px solid var(--document-accent);padding-top:18px}[data-template=modern] .items-table th{background:var(--document-accent);color:white}[data-template=modern] .grand-total{background:var(--document-accent);color:white;padding:12px;border:0;border-radius:5px}[data-template=minimal] .invoice-title{font-weight:500;font-size:28px}[data-template=minimal] .items-table th{border-bottom:1px solid var(--document-accent);font-weight:500}[data-template=minimal] .grand-total{border-top:1px solid var(--document-accent)}
/* The same fixed A4 pages are used by PDF export and browser printing. */
.export-root{position:absolute;left:-10000px;top:0;width:794px;background:white;color:#263647}.document-page{position:relative;width:794px;height:1122px;background:white;padding:40px 42px 56px;overflow:hidden;box-shadow:none;border-radius:0;font-family:'Plus Jakarta Sans',Arial,sans-serif}.page-content{height:auto;display:flow-root}.page-footer{position:absolute;bottom:22px;left:42px;right:42px;display:flex;justify-content:space-between;font-size:9px;color:#64748b;border-top:1px solid #e5eaf0;padding-top:7px}.document-page .hide-print,.document-page .col-action{display:none!important}.document-page .logo-upload{border:none;background:none;cursor:default}.document-page .print-value{display:block;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5;padding:5px 6px;font-size:13px;min-width:0}.document-page .business-name{font-size:15px;font-weight:700}.document-page .meta-row .print-value{width:165px;text-align:right;font-size:12px}.document-page .item-name{font-size:12px;padding:4px 2px}.document-page .money-input{display:none}.document-page .total-row label{font-size:12px}.document-page .signature-section .print-value{text-align:center;font-size:12px}.continuation-header{display:flex;justify-content:space-between;gap:20px;font-size:12px;color:var(--document-accent);margin-bottom:20px}.document-page .items-table td{padding:8px 5px}.document-page .items-scroll{overflow:visible}.document-page .notes-section .print-value{font-size:12px}.document-page .document-summary{break-inside:avoid}
@media(max-width:950px){.container{flex-direction:column}.invoice-wrapper{width:100%}.sidebar{width:100%;display:grid;grid-template-columns:1fr 1fr}.invoice-header{gap:12px}}@media(max-width:550px){.container{padding:0 10px;margin:14px auto}.invoice-wrapper{padding:18px 12px}.sidebar{grid-template-columns:1fr}.top-nav{padding:14px}.logo{font-size:16px}.invoice-title{font-size:24px}.logo-upload{width:100px;height:65px}.meta-row{gap:3px}.meta-row .input-plain{width:133px;font-size:11px}.addresses{gap:12px}.business-name{font-size:13px}.items-table th{font-size:9px}.col-name{width:37%}.col-qty{width:13%}.col-price{width:24%}.col-total{width:26%}.items-table .input-plain{font-size:11px}.document-bottom{flex-direction:column;align-items:stretch}.signature-section{align-self:flex-end}.totals{width:100%}.total-row label{font-size:10px}.tool-card{padding:16px}.nav-actions .btn{font-size:11px;padding:8px}}
@page{size:A4 portrait;margin:0}@media print{html,body{margin:0;padding:0;background:white}body>*:not(.export-root){display:none!important}.export-root{position:static!important;left:auto;top:auto;width:210mm}.document-page{break-after:page;page-break-after:always;print-color-adjust:exact;-webkit-print-color-adjust:exact}.document-page:last-child{break-after:auto;page-break-after:auto}}
.document-heading{margin-left:auto;min-width:0}

.invoice-title,.items-table th,.grand-total,.payment-status,.continuation-header{color:var(--document-ink,var(--document-accent))}
[data-template=modern] .items-table th,[data-template=modern] .grand-total{color:var(--document-on-accent,#fff)}
.page-footer span:first-child{min-width:0;overflow-wrap:anywhere}.page-footer span:last-child{white-space:nowrap}.continuation-header>*{min-width:0;overflow-wrap:anywhere}

.header-brand{width:42%;min-width:0;flex-shrink:1}.company-title{font-size:26px;font-weight:800;line-height:1.2;overflow-wrap:anywhere;color:var(--document-ink,var(--document-accent));padding-top:4px}.document-page .company-title{font-size:26px}.header-brand .logo-upload{max-width:100%}
@media(max-width:550px){.header-brand{width:36%}.company-title{font-size:18px}}
/* Sharp text in downloads uses embedded vector fonts. */
@font-face{font-family:InvoiceDocument;src:url('../fonts/invoice-regular.ttf') format('truetype');font-weight:400;font-display:block}@font-face{font-family:InvoiceDocument;src:url('../fonts/invoice-bold.ttf') format('truetype');font-weight:700 900;font-display:block}.document-page{font-family:InvoiceDocument,Arial,sans-serif}.document-page .print-value{font-family:inherit}.address-box:last-child{text-align:right}.address-box:last-child .input-plain{text-align:right}.document-page .address-box:last-child .print-value{text-align:right}.signature-section{width:var(--signature-width,140px);max-width:100%}.signature-section img{height:auto;max-height:90px;object-fit:contain}.signature-section .signature-caption{font-size:9px}.signature-section .input-plain{font-size:11px}.document-state{font-size:10px;font-weight:800;color:#9a3412;text-align:right;margin-bottom:8px}.document-alert{max-width:1180px;margin:16px auto;background:#fef2f2;color:#991b1b;padding:14px;border:1px solid #fecaca;border-radius:8px}.invoice-wrapper.read-only .btn-add-item,.invoice-wrapper.read-only .btn-remove{display:none}.invoice-wrapper.read-only .input-plain{opacity:1;color:inherit;-webkit-text-fill-color:currentColor}.signature-section .print-value{overflow-wrap:anywhere}
/* Additional subscriber templates. All keep the same accessible A4 structure. */
[data-template=executive] .invoice-header{background:#12263a;padding:18px;border-radius:7px}[data-template=executive] .invoice-header .invoice-title,[data-template=executive] .invoice-header .company-title,[data-template=executive] .invoice-header .meta-row,[data-template=executive] .invoice-header .meta-row>span,[data-template=executive] .invoice-header .payment-status{color:white}[data-template=executive] .invoice-header .logo-upload{background:white;padding:5px}[data-template=executive] .items-table th{background:#12263a;color:white}[data-template=executive] .grand-total{background:#edf2f7;padding:12px;border-top:3px solid var(--document-accent)}
[data-template=elegant] .invoice-header{border-bottom:1px solid var(--document-accent);padding-bottom:20px}[data-template=elegant] .invoice-title{letter-spacing:3px;font-weight:400}[data-template=elegant] .items-table th{font-weight:400;letter-spacing:1px;border-bottom:1px solid var(--document-accent)}[data-template=elegant] .grand-total{border:1px solid var(--document-accent);padding:12px}
[data-template=slate] .invoice-header{background:#eef3f7;padding:16px;border-left:5px solid var(--document-accent)}[data-template=slate] .items-table tbody tr:nth-child(even){background:#f3f6f9}[data-template=slate] .items-table th{background:#e8eef4}[data-template=slate] .grand-total{background:#e8eef4;padding:12px}
[data-template=compact] .invoice-header{margin-bottom:12px}[data-template=compact] .invoice-title{font-size:24px}[data-template=compact] .addresses{margin-bottom:10px}[data-template=compact] .items-table td{padding:4px}[data-template=compact] .print-value{font-size:11px}[data-template=compact] .total-row{padding:4px 0}[data-template=compact] .document-bottom{margin-top:12px}
[data-template=letterhead] .invoice-header{border-top:8px solid var(--document-accent);border-bottom:2px solid var(--document-accent);padding:18px 0}[data-template=letterhead] .company-title{font-size:28px}[data-template=letterhead] .invoice-title{font-size:24px;font-weight:400}[data-template=letterhead] .items-table th{border-top:1px solid var(--document-accent)}
#sharingTools label{display:block;font-size:12px;margin:12px 0 5px}#sharingTools textarea{width:100%;resize:vertical}
