:root{font-family:system-ui,-apple-system,"Segoe UI",Arial,sans-serif;color:#172b3a;background:#f4f7fa;--blue:#0864ae;--blue2:#0c416d;--light:#e8f2fa;--border:#dbe3ea;--muted:#657685}*{box-sizing:border-box}body{margin:0;padding:0 0 calc(78px + env(safe-area-inset-bottom));}button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{opacity:.52;cursor:not-allowed}.startup{position:fixed;inset:0;z-index:100;background:#fff;display:grid;place-items:center;color:#375874}.top{height:90px;background:linear-gradient(120deg,#fff,#eff6fb);border-bottom:1px solid #d4e1ed;padding:13px max(18px,env(safe-area-inset-left));display:flex;align-items:center;justify-content:space-between}.brand{display:flex;flex-direction:column;gap:0;min-width:0}.brand img{width:min(270px,68vw);height:48px;object-fit:contain;object-position:left}.brand small{font-size:12px;color:#546a79;margin-left:4px}.version{font-size:12px;color:#75818b;align-self:flex-start}.page{max-width:750px;margin:auto;padding:24px 16px 55px}h1{font-size:clamp(26px,6vw,34px);letter-spacing:-.035em;margin:10px 0 9px}h2{font-size:18px;margin:0 0 16px;letter-spacing:-.02em}h3{margin:0;font-size:15px}.subtitle,.muted,.hint{color:var(--muted)}.subtitle{font-size:14px;margin-top:0;margin-bottom:22px}.hint{font-size:12px;line-height:1.5;margin:10px 0 0}.small{font-size:12px}.welcome{margin:8px 3px 23px}.welcome p{color:var(--muted);line-height:1.5;margin:0}.main-action{display:flex;align-items:center;gap:15px;width:100%;border:0;border-radius:17px;background:linear-gradient(120deg,#0b5c9f,#083c68);color:white;text-align:left;padding:24px 22px;box-shadow:0 6px 17px #174d7940}.main-action strong{display:block;font-size:23px}.main-action small{display:block;font-size:13px;color:#cce1f2;margin-top:3px}.bigplus{font-size:38px;font-weight:300}.quick{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:19px 0}.quick button{border:1px solid var(--border);border-radius:15px;min-height:93px;background:white;color:#34566d;font-size:22px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px}.quick strong{font-size:14px}.tip{background:#eaf1f7;border-radius:12px;padding:14px;color:#527084;font-size:13px}.panel,.record,.line{background:#fff;border:1px solid var(--border);border-radius:16px}.panel{padding:21px 18px;margin-bottom:14px;box-shadow:0 2px 8px #0b315108}.panel-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.panel-heading small{color:var(--muted);font-size:11px}label{display:flex;flex-direction:column;gap:7px;margin-bottom:15px;font-size:13px;color:#2a3d4d;font-weight:650}.req{color:#bc3c3c}input,select,textarea{width:100%;border:1px solid #cfd9e0;border-radius:10px;padding:11px 12px;background:#fff;color:#182c39;outline:none;min-height:44px;font-size:15px}textarea{resize:vertical}input:focus,textarea:focus,select:focus{border-color:#0964ae;box-shadow:0 0 0 3px #0c79c521}.two{display:grid;grid-template-columns:1fr 1fr;gap:11px}.two>*{min-width:0}.segments{display:flex;border:1px solid var(--border);border-radius:11px;padding:3px;background:#f7f9fb;gap:4px}.segments button{width:50%;border:0;border-radius:8px;background:transparent;color:#456174;padding:11px}.segments button.active{background:var(--blue2);color:#fff;font-weight:700}.checkrow{flex-direction:row;align-items:center;gap:10px;font-weight:450;font-size:13px}.checkrow input{width:18px;height:18px;min-height:0;accent-color:var(--blue)}button.primary,button.soft,button.outline,button.danger{border-radius:11px;padding:11px 14px;min-height:43px;font-size:14px;font-weight:650}button.primary{background:var(--blue2);color:#fff;border:1px solid var(--blue2)}button.soft{background:#e9f0f6;border:1px solid #e9f0f6;color:#164869}button.outline{background:#fff;border:1px solid #b7c9d5;color:#22506d}button.danger{background:#fff1f0;color:#a73535;border:1px solid #f2cac8}.back{border:0;background:none;padding:5px 0;color:#276590;font-weight:600;font-size:13px}.section-top{display:flex;justify-content:space-between;align-items:center;gap:10px}.line{padding:13px;margin-bottom:11px;background:#fcfdfe}.line-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}.line-head h3{color:#506478}.linkbtn{border:0;background:transparent;color:#266491;padding:5px 2px;font-size:13px;font-weight:650}.row-inputs{display:grid;grid-template-columns:minmax(0,1fr) 70px minmax(0,1.2fr);gap:9px}.row-inputs .unit{min-width:0}.row-inputs label{font-size:12px}.row-meta{display:grid;grid-template-columns:1fr 1fr;gap:9px}.row-meta label{font-size:12px}.line-actions{display:flex;justify-content:space-between;align-items:center;gap:8px}.line-amount{font-size:15px;color:#13496d;font-weight:800}.mini-actions{display:flex;gap:12px}.inlineadd{border:1px dashed #91b4ce;border-radius:10px;background:#f1f7fb;color:#175c87;padding:11px 15px;font-size:14px;font-weight:700;width:100%;margin-top:4px}.total-summary{border-top:1px solid #dce6ed;margin-top:18px;padding-top:14px;font-size:13px;color:#526779}.sumrow{display:flex;justify-content:space-between;margin:5px 0}.sumrow.big{font-size:22px;font-weight:800;color:#12364f;margin-top:12px}.sticky-actions{display:flex;gap:7px;margin:16px 0 10px}.sticky-actions button{flex:1;padding:11px 6px}.filterbar{display:flex;gap:8px;margin:14px 0}.filterbar input{flex:2;min-width:0}.filterbar select{flex:1;min-width:0}.record{padding:14px 15px;margin-bottom:12px}.record-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.record strong{font-size:15px}.record .muted{font-size:12px;margin-top:4px}.record .amount{font-size:17px;font-weight:800;color:#123d5c}.status{display:inline-block;border-radius:30px;padding:3px 8px;font-size:11px;font-weight:650;background:#eaf3fa;color:#23557b;margin-top:5px}.status.paid{color:#256442;background:#e4f6ec}.status.draft{color:#77582c;background:#fcf1da}.record-actions,.buttons{display:flex;gap:7px;flex-wrap:wrap;margin-top:12px}.record-actions button{font-size:12px;min-height:36px;padding:8px 10px}.stack-buttons{display:grid;gap:9px}.bottomnav{position:fixed;bottom:0;left:0;right:0;display:flex;justify-content:center;background:#fff;border-top:1px solid var(--border);padding:9px 4px calc(8px + env(safe-area-inset-bottom));z-index:12}.bottomnav button{width:min(20%,110px);border:0;background:transparent;color:#637a8b;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;font-size:22px}.bottomnav span{font-size:10px}.bottomnav button.active{color:var(--blue);font-weight:700}.toast{position:fixed;bottom:calc(85px + env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);z-index:50;background:#14384e;color:white;border-radius:11px;padding:12px 15px;box-shadow:0 7px 25px #0004;min-width:220px;text-align:center;max-width:95vw;font-size:13px}.toast.error{background:#852f2f}dialog{border:0;border-radius:16px;box-shadow:0 20px 80px #0008;max-width:calc(100vw - 15px);padding:0}dialog::backdrop{background:#10283dbc}#preview-dialog{width:min(790px,100vw);height:min(92vh,900px);overflow:hidden}.dialog-bar{display:flex;align-items:center;justify-content:space-between;padding:12px;border-bottom:1px solid var(--border)}#preview-frame{display:block;border:0;width:100%;height:calc(100% - 132px);background:#f8f8f8}.dialog-actions{display:flex;gap:8px;padding:12px}.dialog-actions button{flex:1}.update-body{padding:25px;max-width:360px}.update-body p{font-size:14px;color:var(--muted)}.empty{padding:30px 10px;text-align:center;color:var(--muted);background:#fff;border:1px dashed var(--border);border-radius:12px}@media(max-width:355px){.row-inputs{grid-template-columns:minmax(0,1fr) 57px minmax(0,1.1fr)}.panel{padding:16px 12px}.sticky-actions{flex-direction:column}.sticky-actions button{width:100%}}

/* v0.2: search menus, customer mode and offline PDF pages */
.customer-types{margin:8px 0 16px}.customer-types button{font-size:1rem;font-weight:650;min-height:46px}.suggest-wrap{position:relative;min-width:0}.suggestions{position:absolute;left:0;right:0;top:100%;z-index:30;background:#fff;color:#172a3b;border:1px solid #a5c4dc;border-radius:11px;max-height:245px;overflow-y:auto;box-shadow:0 12px 28px #173f6435;margin-top:2px}.suggestions[hidden]{display:none}.suggestion{display:block;width:100%;background:#fff;color:#172a3b;text-align:left;padding:12px;border:0;border-bottom:1px solid #e7eff6;min-height:48px}.suggestion.selected{background:#e9f5ff;color:#075087}.suggestion small{display:block;color:#51667a;margin-top:3px;font-size:.8rem}.suggestion strong{display:block}.suggestion:focus-visible{outline:2px solid #0c70c1;outline-offset:-2px}.pdf-pages{overflow-y:auto;overscroll-behavior:contain;flex:1;min-height:0;background:#c9d2de;padding:14px 8px;text-align:center}.pdf-pages img{width:100%;max-width:650px;height:auto;display:block;margin:0 auto 16px;background:#fff;box-shadow:0 3px 12px #12243633}.pdf-pages .preview-busy{padding:24px;background:#fff;border-radius:12px}.line .product-search{width:100%}#selected-customer-status{margin-top:-8px}#customer-zip,#reg-cust-zip{min-width:0}@media(max-width:420px){.suggestions{max-height:200px}}
#preview-dialog[open]{display:flex;flex-direction:column;max-height:92dvh}
#preview-dialog .dialog-bar,#preview-dialog .dialog-actions{flex:none}
#preview-dialog .pdf-pages{flex:1;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch}
[hidden]{display:none!important}

/* v0.3 accessible compact rows and responsive field layouts */
html,body,#app,.page,.panel,.line{max-width:100%;min-width:0}
.row-inputs{grid-template-columns:minmax(0,1fr) minmax(0,0.85fr);gap:10px}
.row-inputs>label{min-width:0}.row-inputs>label:last-child{grid-column:1/-1}
.row-meta{grid-template-columns:repeat(2,minmax(0,1fr))}
.line-edit,.line-switch,.line-switch .segments{min-width:0}
.line-switch>span,.reg-type-wrap>span{display:block;font-size:13px;font-weight:650;color:#2a3d4d;margin:0 0 8px}
.line-price-segments button{font-size:13px}.line-tax-segments button{font-size:12px;min-width:0;white-space:normal;padding:11px 5px}
.line-switch{margin:0 0 16px}.line-edit[hidden],.line-summary[hidden]{display:none!important}
.line-footer{display:flex;gap:8px;justify-content:flex-end;border-top:1px solid #e1e8ee;padding-top:13px;margin-top:13px}.line-footer button{flex:1}
.line-summary{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 12px;text-align:left;width:100%;border:0;background:transparent;padding:6px;color:#173247;min-height:58px}
.line-summary strong{grid-column:1;white-space:normal;overflow-wrap:anywhere;font-size:15px}
.line-summary small{grid-column:1;color:#697a88;font-size:12px;line-height:1.45}
.line-summary b{grid-column:2;grid-row:1/3;align-self:center;color:#15466b;font-size:14px;white-space:nowrap}
.line.compact{padding:9px 12px;background:#fff}.line.compact:focus-within{outline:2px solid #0c70c1}
.reg-type-wrap{margin-bottom:14px}
@media(max-width:420px){.panel{padding:16px 12px}.row-inputs{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.row-meta{grid-template-columns:minmax(0,1fr)}.line-switch .segments button{min-width:0}}

/* v0.3.1: compact closed registers and coherent VAT switches */
.registry-toolbar{display:flex;justify-content:flex-end;margin:12px 0 16px}.registry-toolbar button{min-width:175px}.registry-filter{width:100%;margin:8px 0 14px}.registry-editor{scroll-margin-top:65px}.field-heading{font-size:13px;display:block;font-weight:650;margin-bottom:8px;color:#2a3d4d}.vat-preference .segments button{font-size:12px;min-width:0;padding:11px 5px}.vat-preference{margin:14px 0}.product-switches{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.product-switches .segments button{font-size:12px;padding:11px 5px;white-space:normal;min-width:0}.registry-editor textarea{width:100%;resize:vertical;min-height:72px}.registry-editor .hint{line-height:1.5}@media(max-width:430px){.product-switches{grid-template-columns:1fr}.vat-preference .segments button{font-size:11px}}

/* v0.3.2: stable VAT controls and comfortable touch targets */
.line-vat-options,.product-switches{display:flex;flex-direction:column;gap:0}
.line-vat-options .line-switch,.product-switches .line-switch{width:100%;margin:0 0 13px;min-width:0}
.line-vat-options .segments button,.product-switches .segments button{flex:1;min-width:0;min-height:43px}
.segments.is-disabled{opacity:.48}
.segments.is-disabled button{cursor:default}
.line-vat-extras{min-height:0}
.line-vat-extras label[hidden],#reg-prod-rate-wrap[hidden]{display:none}
.line-tax-hint{font-size:12px;line-height:1.35}
.product-save-check{margin:1px 0 0}.product-save-hint{margin:2px 0 14px}
.line-summary small{overflow-wrap:anywhere}

.product-confirm-dialog{width:min(480px,calc(100vw - 20px));max-height:85vh;overflow:auto}
.product-confirm-panel{padding:22px 19px}.product-confirm-panel h2{margin-bottom:7px}
.product-confirm-row{border-bottom:1px solid var(--border);padding:13px 0;display:flex;flex-direction:column;gap:5px}
.product-confirm-row strong{font-size:13px}.product-confirm-row small{font-size:12px;color:var(--muted)}
.product-confirm-row select{margin-top:7px}.product-confirm-error{font-size:13px;color:#9e3434;font-weight:650}

.pdf-sheet{position:relative;max-width:650px;margin:0 auto 16px}.pdf-pages .pdf-sheet img{width:100%;margin:0;max-width:100%;display:block}.copy-bankcode{flex:0 0 auto;min-height:36px;min-width:36px;padding:4px 8px;border-radius:7px;background:#eff6fb;border:1px solid #a6c3d6;color:#204a67;font-size:16px}.copy-bankcode:focus-visible{outline:2px solid #0864ae}

/* v0.3.4: selectable bank-code transcription in raster preview, never stored as an invoice field. */

#remember-customer-wrap[hidden]{display:none!important}

/* v0.3.5: telephone actions and temporary locked seller identity. */
.contact-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:-3px 0 14px}
.contact-button{display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:9px 12px;border-radius:9px;border:1px solid #aac7da;background:#eef5fb;color:#154a6b;text-decoration:none;font-size:13px;font-weight:700;cursor:pointer}
.contact-button:focus-visible{outline:2px solid #0c70c1;outline-offset:2px}.customer-phone-display{margin-top:8px;overflow-wrap:anywhere}
.seller-identity{border:1px solid #c8d7e1;background:#f7fafc;border-radius:12px;padding:14px 13px;margin-bottom:16px}
.identity-heading{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;color:#25455e;font-size:14px}
.identity-lock-icon{font-size:17px}.seller-identity label{touch-action:manipulation}
.seller-identity input[readonly]{background:#edf2f6;color:#375267;border-color:#d1dce5;cursor:default;touch-action:manipulation;-webkit-user-select:none;user-select:none}
.seller-identity.unlocked{border-color:#4f8bae;background:#f2f9fd}
.seller-identity.unlocked input:not([readonly]){background:white;-webkit-user-select:text;user-select:text}
.seller-identity .hint{margin:9px 0 2px}.identity-actions{margin-top:10px}.identity-actions button{min-height:42px}
@media(max-width:390px){.identity-actions{flex-direction:column}.identity-actions button{width:100%}}
/* v0.3.5: the 54-digit transcription sits below the bars, never on top of them.
   PDF page coordinates: barcode ends at y=729/842; transcription starts y~733/842. */
.preview-bankcode-numbers{flex:1;min-width:0;font:400 12px/1.45 Arial,Helvetica,sans-serif;overflow-wrap:anywhere;color:#151d27;user-select:text;-webkit-user-select:text}

/* v0.3.6: delivery events and full PDF history. */
.delivery-tag{display:block;font-size:12px;color:#416178;margin:6px 0 0}
.simple-dialog{border:1px solid #a9c8df;border-radius:15px;padding:0;width:min(470px,calc(100vw - 28px));max-height:85dvh;overflow:auto;box-shadow:0 12px 45px #0d31553d}
.simple-dialog::backdrop{background:#0c1d2c84}
.simple-dialog-inner{padding:22px 20px;display:flex;flex-direction:column;gap:11px}
.simple-dialog-inner h2{font-size:20px;margin:0 0 3px}.simple-dialog-inner h3{font-size:16px;margin:13px 0 0}
.simple-dialog-inner label{display:flex;flex-direction:column;gap:5px;font-weight:650;font-size:13px}.simple-dialog-inner input,.simple-dialog-inner select{width:100%;min-width:0}
.simple-dialog-inner .buttons{display:flex;gap:9px;flex-wrap:wrap}.simple-dialog-inner .buttons button{flex:1}
.history-row{border-bottom:1px solid #dbe4ea;padding:9px 0;font-size:13px;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:5px}.history-row p{margin:2px 0 0;color:#546a7e;width:100%}

/* Archive: always visible date search; independent advanced selectors. */
.archive-controls{padding:15px 16px;margin-bottom:15px}
.archive-controls label{font-size:12px;margin-bottom:9px}
.archive-dates,.archive-filter-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:9px;row-gap:3px}
.archive-search-label{margin-bottom:11px!important}
#archive-advanced{border-top:1px solid var(--border);border-bottom:1px solid var(--border);padding:9px 0;margin:5px 0 10px}
#archive-advanced summary{cursor:pointer;color:#205a81;font-size:13px;font-weight:700;min-height:30px}
.archive-filter-grid{padding-top:12px}
.archive-bottom{display:flex;align-items:end;gap:9px}
.archive-bottom>label{flex:1;min-width:0;margin:0}
.archive-bottom>button{flex-shrink:0;min-height:44px;padding:8px 10px}
.archive-count{font-size:12px;color:#597389;margin-top:12px}
.archive-tags{display:flex;flex-wrap:wrap;gap:5px;margin-top:6px}
.archive-tags .tag{font-size:11px;font-weight:650;border-radius:7px;background:#edf2f7;color:#365975;padding:4px 7px}
.archive-tags .tag.credit{background:#eaf2ff;color:#1a5b9c}
.archive-tags .tag.corrected{background:#f6eee2;color:#855c1c}
.archive-tags .tag.paid{background:#e5f6ea;color:#236343}
.archive-tags .tag.pending{background:#fff4e5;color:#8a5b13}
.archive-tags .tag.replacement{background:#e9f4f7;color:#1d5c72}
.archive-relations{color:#596c7d;font-size:12px;margin-top:6px;line-height:1.45}
.correction-dialog{max-width:470px;width:calc(100vw - 22px);max-height:88vh;overflow:auto}
.correction-document{border:1px solid var(--border);padding:10px;border-radius:10px;margin:8px 0}
.correction-document .buttons{margin-top:6px}
.correction-document strong{font-size:14px}
.correction-dialog .buttons>button{flex:1}
.history-chain{border-top:1px solid var(--border);padding-top:12px;margin-top:12px}
@media(max-width:375px){.archive-filter-grid{grid-template-columns:1fr}.archive-controls{padding:13px}.archive-bottom{flex-direction:column;align-items:stretch}.archive-bottom>button{width:100%}}
.record-head>div:first-child{flex:1;min-width:0}
.record-head .amount{white-space:nowrap;text-align:right;font-size:clamp(14px,4vw,17px)}

#app-logo[hidden]{display:none}#app-name{font-size:17px;font-weight:650;color:#173952;overflow-wrap:anywhere}

/* Compact brand row; the theme is supplied by the signed profile. */
.top{height:auto;min-height:60px;padding:10px max(16px,env(safe-area-inset-left));gap:10px;background:linear-gradient(120deg,#fff,color-mix(in srgb,var(--blue) 7%,white))}
.brand{display:flex;flex-direction:row;align-items:center;gap:10px;flex:1;min-width:0}
.brand img{width:auto;max-width:min(var(--app-logo-width,120px),36vw);height:34px;object-fit:contain;flex-shrink:0}
#app-name{margin:0;font-size:clamp(14px,4vw,17px);line-height:1.2;color:var(--ink,#173952)}
.version{align-self:center;white-space:nowrap;flex-shrink:0;font-size:11px}
.main-action{background:var(--blue2);color:var(--on-accent,#fff);box-shadow:0 6px 17px color-mix(in srgb,var(--blue2) 24%,transparent)}
.main-action small{color:inherit;opacity:.87}.segments button.active,button.primary{color:var(--on-accent,#fff)}
button.soft,.tip,.inlineadd{background:color-mix(in srgb,var(--blue) 9%,white)}
button.soft,.inlineadd,button.outline,.back,.linkbtn,.bottomnav button.active{color:var(--accent-ink,#244052)}

.quick button{color:var(--accent-ink,#34566d)}.tip{padding:11px 14px}



/* E4.3b – compact offline document naming settings */
.local-filename{border:1px solid #d5e0e8;border-radius:10px;padding:12px;min-width:0;margin:16px 0}
.local-filename legend{font-weight:650;padding:0 6px}
.local-filename .buttons{flex-wrap:wrap;gap:6px;margin:6px 0}
.local-filename .buttons button{flex:0 1 auto;padding:7px 10px;min-width:0;font-size:13px}
.local-filename-result{border:1px solid #d5e0e8;border-radius:8px;padding:10px;margin:8px 0;overflow-wrap:anywhere;min-width:0}
.local-filename-result span{display:block;font-size:12px;margin-bottom:4px}
.local-filename-result output{display:block;font-weight:600;white-space:normal;overflow-wrap:anywhere}

/* Virtual payment number is an app control, never drawn over a saved PDF. */
.virtual-bankcode{display:flex;align-items:center;gap:8px;padding:10px;background:#fff;border-top:1px solid #d0dce6}
