:root{--navy:#0e2b47;--navy2:#173c59;--mint:#167c75;--mint-light:#e6f4f1;--bg:#f2f6f8;--line:#dce7ed;--soft:#f8fafb;--text:#213b4c;--muted:#6f8392;--radius:18px;--shadow:0 12px 45px rgba(19,45,65,.07);font-family:Tahoma,'Segoe UI',Arial,sans-serif;color:var(--text)}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg)}button,input,textarea{font:inherit}button{cursor:pointer}button:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid #85d5c8;outline-offset:2px}button:disabled{opacity:.5;cursor:not-allowed}.topbar{min-height:84px;padding:16px max(22px,calc((100vw - 1536px)/2 + 28px));background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:12px}.brand-mark{display:flex;align-items:center;gap:12px}.brand-mark img{width:46px;height:46px;border-radius:12px}.brand-mark strong{display:block;font-size:19px;letter-spacing:-.35px;color:var(--navy)}.brand-mark small{display:block;font-size:10px;letter-spacing:1.5px;color:#82929b;direction:ltr;text-align:right;margin-top:4px}.top-actions{display:flex;gap:9px}.btn{border:0;display:inline-flex;align-items:center;justify-content:center;gap:7px;border-radius:11px;padding:12px 17px;font-size:13.5px;font-weight:700;transition:transform .13s,background .13s;white-space:nowrap}.btn:active{transform:translateY(1px)}.btn-primary{background:#167b74;color:white}.btn-primary:hover{background:#106b65}.btn-print{background:var(--navy);color:#fff}.btn-print:hover{background:#1a4563}.btn-outline{background:#fff;color:var(--navy);border:1px solid #d9e3ea}.btn-outline:hover,.btn-subtle:hover{background:#ebf2f4}.btn-ghost{background:#f2f6f8;color:#315267}.btn-subtle{background:#ebf5f3;color:#176b65}.app-grid{max-width:1536px;margin:auto;padding:32px 28px 52px;display:grid;grid-template-columns:minmax(430px,.98fr) minmax(500px,1fr);gap:28px;align-items:start}.section-heading{display:flex;justify-content:space-between;align-items:center;gap:16px;margin:1px 0 24px}.eyebrow{display:block;color:var(--mint);font-size:12px;font-weight:800;letter-spacing:.1px;margin-bottom:6px}.section-heading h1{color:var(--navy);font-size:28px;margin:0 0 8px;line-height:1.3;letter-spacing:-.7px}.headline-accent{color:var(--mint)}.section-heading p{font-size:13px;color:#778c98;margin:0}.surface{background:#fff;border:1px solid #e6edf0;border-radius:var(--radius);box-shadow:var(--shadow)}.editor-surface{padding:25px}.block-title{display:flex;align-items:center;gap:10px;margin:0 0 20px;font-size:16px;color:var(--navy)}.step-icon{width:28px;height:28px;border-radius:9px;background:#e5f3f0;display:inline-flex;align-items:center;justify-content:center;color:#18756e;font-size:15px}.input-grid,.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:15px}.field{display:flex;flex-direction:column;gap:8px;font-size:12px;font-weight:700;color:#476174;min-width:0}.field input,.field textarea{width:100%;min-height:47px;border:1px solid #d9e4e9;border-radius:10px;padding:11px 12px;background:#fafcfd;color:var(--navy);font-size:14px;transition:border-color .2s}.field input:focus,.field textarea:focus{background:#fff;border-color:#6cb9ac}.field textarea{resize:vertical;min-height:60px}.field input::placeholder,.field textarea::placeholder{color:#a3b1b8}.span-two{grid-column:span 2}#invoiceNumber{direction:ltr;text-align:right}.block-separator{height:1px;background:#eaf0f2;margin:24px 0}.block-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}.block-heading .block-title{margin-bottom:14px}.mini-note{font-size:11px;color:#7b8c97}.items-head,.item-row{display:grid;grid-template-columns:minmax(145px,2fr) minmax(66px,.9fr) minmax(60px,.62fr) minmax(100px,1.1fr) 33px;gap:8px;align-items:center}.items-head{padding:0 3px 10px;font-size:10.5px;color:#7f919b;white-space:nowrap}.items-body{display:flex;flex-direction:column;gap:10px}.item-row input{min-width:0;width:100%;height:43px;border:1px solid #dce5ea;border-radius:9px;padding:8px;background:#fbfdfd;font-size:12.5px;color:var(--navy);transition:border-color .2s}.item-row input:focus{background:#fff;border-color:#5aab9c;outline:2px solid #d3ede7}.item-row input[type=number]{direction:ltr;text-align:center}.item-row input[data-key=qty]{text-align:center;direction:ltr}.item-row input[data-key=price]{text-align:right;direction:ltr;padding-inline:7px}.item-row input[data-key=name]{direction:auto}.delete-item{height:35px;width:32px;border:0;border-radius:8px;color:#b16c6b;background:#fff2f0;font-size:20px}.delete-item:hover{background:#ffe7e3}.add-row{margin-top:14px;width:100%;min-height:43px;background:#f4faf8;border:1px dashed #97cbc0;border-radius:10px;color:#14776e;font-weight:700;font-size:13px}.add-row:hover{background:#eaf5f2}.total-card{border-radius:13px;background:#f4f9f9;border:1px solid #e0eeeb;padding:18px 19px}.calc-line,.vat-line,.total-line{display:flex;align-items:center;justify-content:space-between;gap:10px}.calc-line{font-size:13px;color:#6d828e;margin-bottom:17px}.calc-line strong,.vat-line strong{font-size:13px;color:var(--navy);white-space:nowrap}.vat-line{padding-bottom:15px;border-bottom:1px solid #dbeae8}.checkbox-label{display:flex;align-items:center;gap:8px;color:#526c7a;font-size:12px;font-weight:700;cursor:pointer}.checkbox-label input{accent-color:#1a7d75;width:17px;height:17px}.rate-field{display:flex;gap:4px;align-items:center;font-size:12px;color:#617a87}.rate-field input{width:56px;text-align:center;border:1px solid #d0e1df;border-radius:7px;height:31px;direction:ltr;background:#fff}.total-line{padding:18px 0 16px}.total-line span{display:block;font-weight:800;font-size:15px;color:var(--navy)}.total-line small{display:block;color:#8b9ca4;font-size:11px;margin-top:5px}.total-line strong{font-size:23px;color:#0b7166;letter-spacing:-.6px;white-space:nowrap}.words-label{font-weight:800;font-size:11px;color:#4a847f}.words-value{font-size:13px;line-height:1.9;color:#355569;margin-top:5px}.note-field{margin-top:20px}.editor-buttons{display:flex;gap:12px;margin-top:22px}.editor-buttons .btn{flex:1;min-height:49px}.local-note{font-size:11px;line-height:1.8;color:#8093a0;margin-top:17px;padding:0 5px}.preview-section{min-width:0;position:sticky;top:22px}.preview-heading{display:flex;align-items:center;justify-content:space-between;margin:0 0 18px;padding:2px 6px}.preview-heading>div{display:flex;align-items:center;gap:9px}.preview-heading strong{font-size:15px;color:var(--navy)}.preview-heading small{font-size:11px;color:#9ba9b1}.preview-dot{width:8px;height:8px;background:#2db6a3;border-radius:50%;box-shadow:0 0 0 4px #d7eee9}.paper-tag{font-size:10px;border:1px solid #cbdfe1;background:white;border-radius:6px;padding:5px 9px;color:#668087;letter-spacing:.4px}.receipt{--paper-text:#171f27;background:white;border:1px solid #e7edf0;box-shadow:0 18px 50px rgba(25,55,67,.09);color:var(--paper-text);padding:35px 36px 30px;min-height:890px;display:flex;flex-direction:column;font-family:Arial,Tahoma,sans-serif}.receipt-head{display:grid;grid-template-columns:1fr 75px 1fr;gap:12px;align-items:center;padding-bottom:15px}.receipt-info-ar{text-align:right;line-height:1.65}.receipt-info-en{text-align:center;direction:ltr;line-height:1.7}.receipt-name{font-size:18px;font-weight:800;line-height:1.3}.receipt-info-en .receipt-name{font-size:17px}.receipt-addr{font-size:11px}.receipt-extra{font-size:11px}.receipt-logo{display:flex;align-items:center;justify-content:center}.receipt-logo img{width:67px;height:82px;object-fit:contain}.receipt-tiny{text-align:center;font-size:11px;margin-top:6px}.receipt-meta{border-top:1px solid #333;padding-top:11px;margin-top:3px;font-size:12px}.meta-line{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:11px}.meta-line .split{margin-inline-start:auto}.meta-key{color:#434b52}.meta-value{font-weight:700}.receipt-table{border-collapse:collapse;table-layout:fixed;width:100%;direction:rtl;font-size:11px}.receipt-table th{border:1px solid #30373c;font-size:11px;padding:7px 4px;line-height:1.55;text-align:center;background:#f9f9f9}.receipt-table td{border-left:1px solid #30373c;border-right:1px solid #30373c;padding:7px 5px;vertical-align:top}.receipt-table .table-amount{text-align:left;font-variant-numeric:tabular-nums;white-space:nowrap;direction:ltr}.receipt-table .table-qty{text-align:center}.receipt-table .table-name{direction:ltr;text-align:left;overflow-wrap:anywhere}.receipt-table .table-moh{text-align:center;overflow-wrap:anywhere}.receipt-table tr:last-child td{border-bottom:1px solid #30373c}.receipt-table tr:has(.empty-cell) td{height:23px}.receipt-table tr.stretch-row td{height:170px}.receipt-table tr{break-inside:avoid}.receipt-table thead{display:table-header-group}.receipt-body-end{margin-top:auto}.receipt-sums{border-left:1px solid #30373c;border-right:1px solid #30373c;border-bottom:1px solid #30373c;padding:12px 8px 4px;direction:ltr}.receipt-sums .sum-row{display:flex;align-items:center;justify-content:flex-end;gap:12px;margin-bottom:8px;font-size:12px}.receipt-sums .sum-row span{min-width:110px;text-align:right;font-weight:700}.receipt-sums .sum-row strong{min-width:116px;text-align:right;font-variant-numeric:tabular-nums}.receipt-sums .sum-total{font-size:13px}.receipt-words{min-height:46px;padding:11px 3px;border-bottom:1px solid #555;font-size:12px;line-height:1.7;text-align:right}.receipt-notes{margin-top:12px;font-size:11px;color:#222}.receipt-signatures{display:flex;justify-content:space-between;align-items:end;padding:35px 5px 6px;font-size:12px}.receipt-signatures>div{text-align:center;min-width:140px}.receipt-signatures strong,.receipt-signatures span{display:block}.receipt-signatures span{margin-top:5px;font-weight:700}.receipt-foot{margin-top:28px;display:flex;justify-content:space-between;border-top:1px solid #ddd;padding-top:10px;font-size:9px;color:#717171}.modal{border:0;border-radius:18px;max-width:min(650px,calc(100vw - 24px));width:100%;padding:0;box-shadow:0 18px 65px rgba(10,25,37,.24);max-height:90dvh;color:var(--text)}.modal::backdrop{background:rgba(7,30,45,.42);backdrop-filter:blur(3px)}.modal-inner{padding:25px;max-height:90dvh;overflow-y:auto}.modal-head{display:flex;justify-content:space-between;align-items:start;gap:10px}.modal-head h2{margin:0;color:var(--navy)}.icon-btn{width:33px;height:33px;border:0;border-radius:9px;background:#edf3f6;color:#416074}.modal-desc{font-size:12px;color:#7c8f9b;line-height:1.8}.history-list{display:flex;flex-direction:column;gap:9px;margin-top:16px;max-height:320px;overflow:auto}.history-entry{border:1px solid #e2edf0;border-radius:11px;padding:12px 13px;display:flex;justify-content:space-between;align-items:center;gap:9px}.history-entry small{display:block;color:#8396a2;font-size:11px;margin-top:5px}.history-entry strong{font-size:13px}.history-controls{display:flex;gap:5px}.history-controls button{border:1px solid #dfebec;background:#f8fbfb;color:#286d67;border-radius:7px;padding:8px;font-size:12px}.history-controls button.danger{color:#b44b45;background:#fff8f7}.history-empty{background:#f5f9f8;border:1px dashed #cfdfdc;text-align:center;padding:28px;color:#7b939a;border-radius:13px}.dialog-actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:24px}.settings-grid{margin-top:20px}.toast{position:fixed;bottom:20px;left:20px;background:#0e2b47;color:white;padding:13px 18px;border-radius:10px;box-shadow:0 8px 30px #0e2b472a;font-size:13px;max-width:min(360px,calc(100vw - 30px));z-index:20;opacity:0;transform:translateY(12px);pointer-events:none;transition:.2s}.toast.show{opacity:1;transform:none}@media(max-width:1220px){.app-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:19px;padding-inline:20px}.receipt{padding:24px 20px;min-height:800px}.editor-surface{padding:20px}.items-head,.item-row{grid-template-columns:minmax(110px,2fr) minmax(56px,.85fr) 50px minmax(85px,1fr) 28px;gap:5px}}@media(max-width:980px){.app-grid{display:flex;flex-direction:column;max-width:740px;margin:auto;padding:23px 16px 45px}.editor-panel,.preview-section{width:100%}.preview-section{position:static}.receipt{max-width:680px;margin:auto;min-height:750px;padding:35px}.section-heading h1{font-size:25px}}@media(max-width:610px){.topbar{padding:12px 14px;min-height:70px}.brand-mark img{width:40px;height:40px}.brand-mark strong{font-size:16px}.brand-mark small{font-size:8px}.top-actions{gap:6px}.top-actions .btn{font-size:11px;padding:10px}.top-actions .btn span{display:none}.app-grid{padding:18px 12px 42px;gap:23px}.section-heading{margin-bottom:17px}.section-heading h1{font-size:22px}.section-heading p{font-size:12px}.section-heading .btn{font-size:11px;padding:9px 10px}.editor-surface{padding:17px 14px}.input-grid{gap:12px}.field input{font-size:13px}.items-head{display:none}.items-body{gap:11px}.item-row{border:1px solid #dce8e7;padding:12px;background:#fafeff;border-radius:11px;display:grid;grid-template-columns:1fr 1fr 44px;gap:9px}.item-row .cell-name{grid-column:1/-1}.item-row .cell-moh{grid-column:1/2}.item-row .cell-qty{grid-column:2/3}.item-row .cell-price{grid-column:1/3}.item-row .delete-item{grid-column:3/4;grid-row:2/4;align-self:end}.mobile-label{display:block;color:#6b8190;font-weight:700;font-size:10px;margin-bottom:5px}.item-row input{height:41px}.total-line strong{font-size:19px}.editor-buttons{gap:8px}.editor-buttons .btn{font-size:12px;padding-inline:8px}.preview-heading small{display:none}.receipt{padding:20px 14px;min-height:640px}.receipt-head{grid-template-columns:1fr 48px 1fr;gap:4px}.receipt-logo img{width:47px;height:58px}.receipt-name{font-size:13px}.receipt-info-en .receipt-name{font-size:12px}.receipt-addr,.receipt-extra,.receipt-tiny{font-size:8px}.receipt-meta{font-size:9px}.receipt-table th,.receipt-table td{font-size:8px;padding:5px 2px}.receipt-sums .sum-row{font-size:9px}.receipt-sums .sum-row span{min-width:78px}.receipt-sums .sum-row strong{min-width:90px}.receipt-words,.receipt-signatures{font-size:9px}.receipt-signatures>div{min-width:100px}.receipt-foot{font-size:8px}.modal-inner{padding:18px}.dialog-actions .btn{flex:1;font-size:11px}.history-entry{flex-wrap:wrap}.history-controls{width:100%;justify-content:end}}@media(max-width:380px){.brand-mark small{letter-spacing:.25px}.top-actions .btn{padding:8px 7px}.input-grid{grid-template-columns:1fr}.input-grid>.field{grid-column:1}.section-heading h1{font-size:20px}.receipt{padding:13px 7px}}


/* --- V2 · Original invoice photo header + borderless A5 receipt --- */
.receipt{font-family:Arial,Tahoma,sans-serif;color:#161616;background:#fff;display:flex;flex-direction:column;box-shadow:0 15px 44px #17293817;border:1px solid #e5e8eb;border-radius:3px;direction:rtl;width:148mm;max-width:100%;min-height:210mm;margin:auto;padding:5mm 5mm 6mm;overflow:visible}
.receipt-fixed-head{position:relative;container-type:inline-size;width:100%;flex:none;}
.receipt-fixed-head img{display:block;width:100%;height:auto;aspect-ratio:446/147;object-fit:fill}
.receipt-header-number{position:absolute;top:85.6%;left:48.45%;font:700 2.75cqw/1 Arial,Tahoma,sans-serif;letter-spacing:-.15px;white-space:nowrap;color:#181818;text-align:left}
.receipt-meta{border:0 !important;padding:3mm 0 0 !important;margin:0;font-size:13px !important;font-weight:600}
.receipt-date,.receipt-due{display:flex;align-items:center;gap:7px;margin-bottom:3mm;min-height:15px}
.receipt-date{direction:ltr;justify-content:space-around}.receipt-date .date-key,.receipt-date .date-key-ar{font-weight:700}.receipt-date strong{min-width:36%;text-align:center}
.receipt-due{direction:ltr}.receipt-due strong{flex:1;text-align:start;min-width:0}.receipt-due>span:last-child{margin-left:auto;direction:rtl}
.receipt-columns{flex:1;min-height:95mm;direction:rtl}
.receipt-column-headings,.receipt-item-line{display:grid;grid-template-columns:9% 16% minmax(0,39%) 17% 19%;align-items:start;gap:0;direction:rtl;border:none !important;outline:none !important}
.receipt-column-headings{font-size:11.5px;font-weight:800;text-align:center;margin-bottom:12px;line-height:1.5}
.receipt-column-headings span{min-width:0}.receipt-column-headings small{display:block;font-size:11px;line-height:1.3;font-weight:700;direction:ltr}
.receipt-item-lines{display:flex;flex-direction:column;gap:8px;}
.receipt-item-line{font-size:12.5px;font-weight:600;line-height:1.3;min-height:20px;break-inside:avoid;page-break-inside:avoid}
.receipt-item-line span{min-width:0;overflow-wrap:break-word}
.receipt-item-line .r-qty,.receipt-item-line .r-moh{text-align:center}
.receipt-item-line .r-name{text-align:left;padding-inline:3px;direction:ltr;unicode-bidi:plaintext;}
.receipt-item-line .r-price,.receipt-item-line .r-amount{text-align:right;font-size:12px;white-space:nowrap;letter-spacing:-.25px;font-variant-numeric:tabular-nums}
.receipt-body-end{margin-top:8mm;break-inside:avoid;page-break-inside:avoid}
.receipt-sums{border:0 !important;padding:0 3px !important;direction:ltr}
.receipt-sums .sum-row{display:grid;grid-template-columns:minmax(0,1fr) 38%;gap:10px;margin-bottom:5px;text-align:right;align-items:center;font-size:13px;font-weight:700}
.receipt-sums .sum-row span{min-width:0;text-align:right}.receipt-sums .sum-row strong{min-width:0;text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}.receipt-sums .sum-total{font-size:15px !important}
.receipt-words{border:0 !important;min-height:0;display:flex;gap:7px;padding:12px 0 5px !important;align-items:baseline;justify-content:space-between;text-align:right;font-size:12.5px;line-height:1.55;font-weight:600}
.receipt-words span:last-child{flex:1}.receipt-notes{margin-top:6px;font-size:12px}
.receipt-signatures{display:flex;justify-content:space-between;align-items:end;padding:11mm 6px 0 !important;gap:8px;font-size:12px !important}
.receipt-signatures>div{min-width:0;text-align:center;flex:1}.receipt-signatures strong,.receipt-signatures span{display:block}.receipt-signatures span{margin-top:2px;font-weight:700}
@page{size:A5 portrait;margin:3.5mm}
@media print{
 html,body{margin:0 !important;padding:0 !important;background:#fff !important;print-color-adjust:exact;-webkit-print-color-adjust:exact}
 .topbar,.editor-panel,.preview-heading,.toast,.modal{display:none !important}
 .app-grid,.preview-section{display:block !important;max-width:none !important;width:100% !important;margin:0 !important;padding:0 !important;position:static !important}
 .receipt{min-height:202mm !important;width:100% !important;max-width:none !important;margin:0 !important;padding:2mm 2mm 0 !important;border:0 !important;box-shadow:none !important;overflow:visible}
 .receipt-meta{font-size:13px !important}.receipt-column-headings{font-size:11.5px !important}.receipt-item-line{font-size:12.5px !important}.receipt-item-line .r-price,.receipt-item-line .r-amount{font-size:12px !important}
 .receipt-sums .sum-row{font-size:13px !important}.receipt-sums .sum-total{font-size:15px !important}.receipt-words{font-size:12.5px !important}.receipt-signatures{font-size:12px !important}
 .receipt-columns{min-height:75mm}
}
@media screen and (max-width:610px){
 .receipt{padding:12px 9px;min-height:600px}
 .receipt-meta{font-size:10px !important;padding-top:10px !important}
 .receipt-column-headings{font-size:9px;margin-bottom:9px}
 .receipt-column-headings small{font-size:9px}
 .receipt-item-line{font-size:9.5px;min-height:15px}
 .receipt-item-line .r-price,.receipt-item-line .r-amount{font-size:9.3px;letter-spacing:-.3px}
 .receipt-columns{min-height:265px}.receipt-body-end{margin-top:10px}
 .receipt-sums .sum-row{font-size:10px;margin-bottom:3px}.receipt-sums .sum-total{font-size:11px !important}
 .receipt-words,.receipt-notes{font-size:10px}.receipt-signatures{font-size:10px !important;padding-top:27px !important}
}

.receipt-brand-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;font-family:Arial,sans-serif;font-size:9.5px;color:#222;margin-top:9mm;padding:0 2px}
@media screen and (max-width:610px){.receipt-brand-footer{font-size:8px;margin-top:13px}}
@media print{.receipt-brand-footer{font-size:9.5px;margin-top:7mm}}
