:root{color-scheme:light;--ink:#152947;--muted:#6c7f98;--bg:#f3f6fb;--blue:#1166e6;--border:#dce5f2;--sidebar:#0d213c}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-family:Inter,system-ui,-apple-system,'Segoe UI',sans-serif;font-size:15px}.layout{display:flex;min-height:100vh}.sidebar{background:linear-gradient(180deg,#112844,#081b33);width:220px;color:white;position:sticky;top:0;height:100vh;padding:20px 10px;display:flex;flex-direction:column;flex-shrink:0}.brand{display:flex;gap:10px;align-items:center;margin-bottom:30px;padding:0 10px}.brand-icon{display:grid;place-items:center;background:#1673ef;width:36px;height:36px;border-radius:11px;font-size:25px}.brand strong{display:block;font-size:17px}.brand small{color:#aebed3;font-size:11px}.sidebar nav{display:grid;gap:6px}.navitem{border:0;display:flex;text-align:left;align-items:center;gap:10px;padding:12px;color:#e8eef6;background:transparent;border-radius:9px;font-weight:600;cursor:pointer}.navitem:hover,.navitem.active{background:#1b4c7d}.sidebar-bottom{font-size:12px;color:#91abc5;margin-top:auto;padding:16px 10px;line-height:1.6}main{width:100%;min-width:0}.topbar{min-height:70px;display:flex;align-items:center;justify-content:space-between;background:white;border-bottom:1px solid var(--border);padding:0 30px;gap:12px}.page{max-width:1150px;margin:0 auto;padding:32px 26px 65px}.pill{padding:8px 11px;border-radius:999px;font-size:12px;font-weight:700}.warning{background:#fff2d8;color:#875414}.titleline{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-bottom:20px}h1{font-size:29px;margin:0 0 6px}h2{margin:0 0 5px;font-size:19px}p{margin:0;color:var(--muted);line-height:1.6}.muted{color:var(--muted)}.hint{color:#52708e;font-size:12px}.notice{border-left:4px solid #d09122;background:#fff5df;padding:16px 18px;border-radius:6px;line-height:1.65;margin:20px 0 24px}.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:20px}.metric,.panel{background:white;border:1px solid var(--border);border-radius:13px;box-shadow:0 1px 2px #142e5b0a}.metric{padding:20px}.metric-title{color:#60758d;font-size:13px}.metric strong{font-size:31px;display:block;margin:10px 0 1px}.metric small{color:#8295ab}.panel{padding:24px;margin:18px 0}.panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:18px}.panel-head p{font-size:13px}.primary,.outline{border:0;padding:11px 16px;border-radius:8px;cursor:pointer;font-weight:700;white-space:normal}.primary{background:var(--blue);color:white}.primary:hover{background:#064fbe}.primary:disabled{background:#99b8e4;cursor:not-allowed}.outline{background:white;border:1px solid #c9d8ed;color:#21517f}.outline:hover{background:#edf5ff}.invoice-list,.line-list{display:grid;gap:10px}.invoice,.line{border:1px solid var(--border);border-radius:10px;padding:17px;background:#f9fbff}.invoice-top{display:flex;justify-content:space-between;align-items:start;gap:20px}.invoice h3{margin:0 0 7px;font-size:16px}.invoice p{font-size:13px}.meta{display:flex;gap:10px;flex-wrap:wrap;margin-top:10px;color:#657990;font-size:13px}.actions{display:flex;gap:9px;flex-wrap:wrap;margin:10px 0 14px}.line{display:flex;align-items:center;gap:12px;line-height:1.5}.line input{width:18px;height:18px;accent-color:var(--blue);flex-shrink:0}.line .value{font-weight:700;margin-left:auto;white-space:nowrap}.footer-actions{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-top:20px;flex-wrap:wrap}.summary{font-weight:700}.note{font-size:12px;margin-top:14px}.empty{color:#8a9aad;font-size:14px;padding:30px;text-align:center;background:#f9fbfe;border:1px dashed #cbd9e9;border-radius:9px}.select{border:1px solid #bfcee0;border-radius:7px;background:white;padding:9px 8px;font-size:14px;color:#20344e}.register-actions{margin-top:13px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}.registered{background:#e3f7e9;color:#246e3a;font-size:12px;border-radius:5px;padding:5px 7px}.prose p{margin:11px 0}#toast{position:fixed;bottom:20px;right:20px;max-width:360px;background:#143f70;color:white;padding:14px 18px;border-radius:8px;box-shadow:0 5px 22px #1a2c4440;display:none;z-index:4}#toast.show{display:block}@media(max-width:800px){.sidebar{width:62px;padding:14px 6px}.brand{padding:0;justify-content:center}.brand>div:last-child{display:none}.navitem{font-size:0;justify-content:center}.navitem span{font-size:20px}.sidebar-bottom{display:none}.cards{grid-template-columns:1fr}.page{padding:23px 14px}.topbar{padding:12px}.panel{padding:16px}.panel-head{flex-direction:column}.invoice-top{flex-direction:column}.line{align-items:flex-start}.line .value{white-space:normal}.titleline .hint{display:none}}@media(max-width:500px){.line{flex-wrap:wrap}.line .value{margin-left:30px}.topbar{font-size:12px}h1{font-size:24px}}

.import-actions{align-items:center;gap:15px;margin-bottom:12px}.import-actions label{font-size:13px;font-weight:700;color:#344d6b}.import-actions input:not([type=file]){display:block;min-width:260px;margin-top:6px;padding:11px 12px;border:1px solid #bfcfe5;border-radius:8px}.file-button{display:inline-flex!important;align-items:center;background:#1166e6;color:#fff!important;padding:12px 15px;border-radius:8px;cursor:pointer;margin-top:18px}.file-button input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.panel-head a.primary{text-decoration:none;display:inline-block}.pill.error{background:#ffe4e3;color:#97362b}.pill.ok{background:#e2f6ec;color:#246348}.invoice button{margin-top:12px}.notice{margin-bottom:22px} .line.disabled{opacity:.65}.line .number{min-width:28px}.error-box{color:#a03426;background:#ffedeb;padding:12px;margin-top:10px;border-radius:7px}.mini{font-size:12px;color:#74869c;margin-top:5px}.invoice small{color:#667c90}#buyer-nip{font-variant-numeric:tabular-nums}#register .registered{display:inline-block;margin-top:9px}button:focus-visible,a:focus-visible{outline:3px solid #63a3fb;outline-offset:2px}@media(max-width:550px){.import-actions{display:grid}.file-button{margin:4px 0 8px}.import-actions input:not([type=file]){min-width:0;width:100%}}

/* v0.17.66 — metadane KSeF i czytelne uzgodnienie kwot */
.ksef-inline{background:#f6f9ff;border:1px solid #dce5f2;border-radius:9px;padding:14px;align-items:end;margin:16px 0}
.ksef-inline label{display:block;flex:1;min-width:230px;color:#425774;font-size:13px;font-weight:650}
.ksef-inline input,.number-input{border:1px solid #bacbdf;border-radius:8px;background:#fff;color:#22344d;padding:10px 12px;width:min(100%,500px);margin-top:6px}
.action-buttons{display:flex;gap:10px;flex-wrap:wrap}
.action-buttons [hidden]{display:none}
#selection-total{max-width:570px;font-size:14px;line-height:1.55}

/* v0.17.68 — direct read-only KSeF */
.direct-controls {margin:0 0 10px}.direct-controls label input {min-width:170px}.direct-panel .invoice .registered {margin-top:0}.direct-panel .panel-head {align-items:center}

/* Only the embedded importer (?embed=1) hides its own duplicate navigation.
   The normal standalone KSeF page stays unchanged. */
html.ksef-embedded .layout { display:block; min-height:0; }
html.ksef-embedded .layout > .sidebar, html.ksef-embedded .topbar { display:none; }
html.ksef-embedded main { width:100%; min-width:0; }
html.ksef-embedded .page { width:100%; max-width:none; margin:0; padding:12px 16px 20px; }
html.ksef-embedded #view-purchases > .titleline,
html.ksef-embedded #view-purchases > .notice,
html.ksef-embedded #view-purchases > .cards { display:none; }
html.ksef-embedded #view-purchases > .panel:first-of-type { margin-top:0; }
html.ksef-embedded .panel { max-width:100%; }
@media(max-width:600px){ html.ksef-embedded .page { padding:8px; } html.ksef-embedded .panel {padding:12px;} }

/* Single-list KSeF workflow, only in the embedded full InstalTask TEST. */
html.ksef-simple #view-purchases > :not(#simple-ksef) { display:none !important; }
html.ksef-simple #simple-ksef { display:block; padding:2px 2px 18px; }
html.ksef-simple #simple-ksef[hidden],
html.ksef-simple #preview-panel[hidden],html.ksef-simple #simple-saved-detail[hidden] { display:none !important; }
html.ksef-simple .page { padding:0 4px 10px; }
.simple-head,.simple-detail-header{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
.simple-head h2{font-size:23px;margin:0 0 4px}
.simple-head p{font-size:13px}
.simple-stage{background:#eaf3ff;border-radius:16px;padding:6px 12px;color:#245c9c;font-size:12px;font-weight:700}
.simple-filters{display:flex;gap:8px;flex-wrap:wrap;margin:18px 0}
.simple-filters button{border:1px solid #cad9ea;border-radius:8px;background:#fff;padding:10px 15px;color:#294b70;font-weight:650;cursor:pointer}
.simple-filters button.is-active{background:#1461d2;border-color:#1461d2;color:white}
.simple-toolbar{display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap;background:#f5f8fc;border:1px solid #e1e8f2;border-radius:12px;padding:13px 16px;margin-bottom:12px}
.simple-toolbar .direct-controls{margin:0;display:flex;align-items:end;gap:10px;flex-wrap:wrap}
.simple-toolbar .direct-controls label{font-size:12px;min-width:170px}
.simple-toolbar .direct-controls input{width:170px;min-width:0}
.simple-toolbar #direct-archive{background:#fff}
.simple-toolbar #simple-buyer{min-width:190px;max-width:240px;flex:1}
.simple-toolbar .simple-buyer-label{font-size:12px;font-weight:700;display:block;color:#334b67}
.simple-toolbar #buyer-nip{min-width:0;width:100%;margin-top:6px;padding:11px 12px;border:1px solid #bfcfe5;border-radius:8px;font-size:14px}
#simple-message #direct-note{font-size:12px;margin:0 0 13px;color:#5e7390}
.simple-search-row{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:16px 0 10px}
.simple-search-row span{font-size:14px;font-weight:700}
.simple-search-row input{padding:10px 12px;border:1px solid #cbd9ea;border-radius:8px;width:min(100%,330px)}
.simple-scroll{width:100%;overflow-x:auto;border:1px solid #dbe5f2;border-radius:11px;background:#fff}
.simple-table{border-collapse:collapse;text-align:left;width:100%;min-width:770px;font-size:13px}
.simple-table th{padding:13px 12px;background:#f3f7fe;color:#6a7c93;font-size:11px;text-transform:uppercase;letter-spacing:.02em}
.simple-table td{padding:13px 12px;border-top:1px solid #e6edf6;vertical-align:middle}
.simple-table td:last-child{white-space:nowrap}
.simple-table button{font-size:12px;padding:9px 12px}
.simple-invoice-number{font-weight:700;max-width:260px;overflow-wrap:anywhere}
.simple-invoice-number small{display:block;margin-top:5px;color:#8491a2;font-size:10px;font-weight:400}
.simple-saved{color:#187347;font-weight:700}
.simple-unsaved{color:#9b5c17;font-weight:700}
#simple-preview > .panel{margin-top:18px}
#simple-preview #preview-panel .panel-head h2{font-size:20px}
#simple-preview #ksef-input{max-width:500px}
#simple-saved-detail{margin:16px 0}
#simple-saved-detail ul{margin:8px 0;line-height:1.7}
.simple-status-label{font-weight:700;font-size:13px;display:flex;align-items:center;gap:9px;margin-top:12px}
.simple-footnote{margin-top:20px;font-size:12px;color:#75859b}
@media(max-width:750px){.simple-head h2{font-size:20px}.simple-toolbar{padding:10px}.simple-toolbar .direct-controls label{min-width:140px}.simple-toolbar .direct-controls input{width:145px}.simple-search-row input{width:100%}}

.simple-save-result{margin:10px 0;font-size:14px;font-weight:700;color:#16734c}
.simple-save-result:empty{display:none}

/* KSeF: first Zapisane jako zakup, second Niezapisane, auth link on right. */
.simple-head-actions{display:flex;align-items:center;gap:10px;justify-content:flex-end;flex-wrap:wrap}
.simple-login-link{display:inline-flex;align-items:center;justify-content:center;gap:6px;background:#1461d2;color:#fff!important;text-decoration:none;font-size:13px;font-weight:700;padding:11px 15px;border-radius:9px;white-space:nowrap}
.simple-login-link:hover{background:#0e4fae}
.simple-login-link:focus-visible{outline:3px solid #f2a900;outline-offset:3px}
.simple-ksef-number{max-width:230px;min-width:170px;overflow-wrap:anywhere;font-size:11px;color:#536a85}
@media(max-width:650px){.simple-head-actions{justify-content:flex-start}.simple-login-link{width:100%}.simple-ksef-number{min-width:160px}}

/* InstalTask TEST: auditable payments on saved KSeF purchases. */
.simple-payment-tools{display:flex;align-items:end;flex-wrap:wrap;gap:10px;padding:13px 14px;background:#f8faff;border:1px solid #e0e8f3;border-radius:10px;margin:8px 0 14px}
.simple-payment-tools[hidden],.purchase-summary[hidden],.purchase-tax-note[hidden]{display:none!important}
.simple-payment-tools label{display:grid;gap:5px;font-size:12px;color:#405675;font-weight:600;min-width:146px;flex:1}
.simple-payment-tools input,.simple-payment-tools select{min-height:38px;border:1px solid #cddaea;background:#fff;border-radius:7px;padding:8px 9px;color:#203854;font-size:13px;max-width:100%}
.simple-payment-tools button{white-space:nowrap;min-height:38px}
.purchase-summary{display:grid;grid-template-columns:repeat(6,minmax(120px,1fr));gap:9px;margin:12px 0}
.purchase-summary-card{padding:12px 13px;background:#fff;border:1px solid #dce7f5;border-radius:9px;display:grid;gap:6px}
.purchase-summary-card small,.purchase-detail-sum small{color:#73849a;font-size:11px}
.purchase-summary-card strong{font-size:17px;font-variant-numeric:tabular-nums;white-space:nowrap}
.purchase-summary-card:last-child strong{color:#ad3e33}
.purchase-tax-note{font-size:12px;color:#75849a;margin:5px 0 16px;line-height:1.5}
.purchase-ledger-table{min-width:1120px}
.purchase-ledger-table td{font-size:12px}
.purchase-ledger-table th{white-space:nowrap}
.purchase-header-sort{background:transparent;border:0;font-size:11px;color:#56718e;font-weight:700;cursor:pointer;padding:1px 0;text-transform:uppercase}
.purchase-amount,.purchase-balance{font-variant-numeric:tabular-nums;white-space:nowrap}
.purchase-balance{font-weight:750}
.purchase-cell-secondary{display:block;font-size:10px;color:#8a99a8;margin-top:3px}
.purchase-muted{color:#8a99a8;font-size:12px}
.purchase-badge{display:inline-block;border-radius:20px;padding:5px 9px;white-space:nowrap;font-weight:650;font-size:11px}
.purchase-paid{color:#146a44;background:#e0f5eb}.purchase-unpaid{color:#735a20;background:#fff1d6}.purchase-partial{color:#825611;background:#fff2d6}.purchase-overdue{color:#aa352f;background:#ffe4e1}
.purchase-ksef-detail{font-size:12px;color:#627795;overflow-wrap:anywhere;margin:8px 0 12px}
.purchase-detail-sums{display:flex;gap:10px;flex-wrap:wrap;margin:16px 0}
.purchase-detail-sum{background:#f3f7fd;border-radius:9px;padding:12px;min-width:140px;display:grid;gap:5px;flex:1}
.purchase-detail-sum strong{font-size:19px;font-variant-numeric:tabular-nums}
.purchase-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.purchase-form{background:#fff;border:1px solid #dfe7f1;border-radius:10px;padding:14px;display:grid;align-content:start;gap:10px}
.purchase-form h4,.purchase-history h4{font-size:14px;margin:0 0 3px}
.purchase-form-line{display:flex;gap:10px;flex-wrap:wrap}
.purchase-field{display:grid;gap:5px;flex:1;min-width:130px;font-size:12px;font-weight:600;color:#425875}
.purchase-field input,.purchase-field select{padding:10px;border:1px solid #cedceb;border-radius:8px;width:100%;min-width:0;font-size:13px}
.purchase-form button{justify-self:start;margin-top:5px}
.purchase-history{margin:16px 0;padding:13px 0;border-top:1px solid #e2ebf6}
.purchase-payment-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:11px 0;border-bottom:1px solid #e7eff8;font-size:12px}
.purchase-payment-row>span{flex:1;min-width:190px}
.purchase-payment-row>strong{font-size:13px}
.purchase-payment-row button{padding:7px 10px;font-size:11px}
.purchase-payment-row.is-voided{opacity:.65;text-decoration:line-through}
.purchase-payment-row.is-voided small{width:100%;text-decoration:none}
.purchase-detail-actions{margin:16px 0}
.purchase-legacy-warning{margin:10px 0;padding:11px;background:#fff5df;color:#805714;border-radius:8px;font-size:12px}
.purchase-error{color:#ab3333}
@media(max-width:950px){.purchase-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.purchase-detail-grid{grid-template-columns:1fr}}
@media(max-width:520px){.purchase-summary-card strong{font-size:15px}.simple-payment-tools label{min-width:100%}}

/* KSeF TEST: szybkie operacje płatności przy zapisanej fakturze. */
.purchase-action-select{max-width:170px;min-width:145px;border:1px solid #ccd9eb;border-radius:8px;background:#fff;color:#183c67;padding:9px 8px;font-size:12px;font-weight:650;cursor:pointer}
.purchase-action-select:focus-visible{outline:3px solid #90baff;outline-offset:2px}
.purchase-quick-dialog{width:min(480px,calc(100vw - 28px));max-width:100%;border:1px solid #d7e4f3;box-shadow:0 16px 65px #152b4970;border-radius:14px;padding:0;color:#16324e}
.purchase-quick-dialog::backdrop{background:#152a43aa}
.purchase-quick-form{padding:24px;display:grid;gap:12px}
.purchase-quick-form h3{margin:0;font-size:20px}
.purchase-quick-form p{font-size:13px;color:#56708f;line-height:1.5;margin:0 0 6px}
.purchase-quick-form label{display:grid;gap:6px;font-size:13px;font-weight:650}
.purchase-quick-form input{padding:11px 12px;max-width:100%;border:1px solid #cbd8e9;border-radius:8px;font-size:15px}
.purchase-quick-form small{color:#6f8198;line-height:1.4}
.purchase-quick-buttons{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:8px}
.purchase-quick-buttons button{min-width:125px}

/* Offscreen KW print preview; no inline styles under strict CSP. */
.kw-print-frame{position:fixed;left:-20000px;top:0;width:1px;height:1px;border:0}

/* Odróżniamy deklarację zapłaty z FA(3) od wpisanej wpłaty bankowej lub gotówkowej. */
.purchase-issuer-paid{color:#17634c;background:#dff3ea;white-space:normal;text-align:center}.purchase-issuer-partial{color:#745317;background:#fff0d1;white-space:normal;text-align:center}
@media(max-width:1350px){.purchase-summary{grid-template-columns:repeat(3,minmax(0,1fr))}}

.purchase-issuer-partial-overdue{color:#9e342f;background:#ffe8df;white-space:normal;text-align:center}
/* Purchase register: import tools only on unsaved/loaded tabs. */
html.ksef-simple #simple-controls[hidden],html.ksef-simple #simple-buyer[hidden]{display:none!important}
html.ksef-simple .purchase-ignore-button{margin-left:6px;color:#81521a;border-color:#e4c89f;background:#fffaf2}

/* PRODUKCJA: tabela zakupów jak w iBiznes, logika zapisów i płatności bez zmian. */
html.ksef-simple .simple-filters{gap:0;border-bottom:2px solid #dce4f1;margin:14px 0 16px;overflow-x:auto;flex-wrap:nowrap}
html.ksef-simple .simple-filters button{border:0;border-bottom:3px solid transparent;border-radius:0;padding:12px 16px;margin-bottom:-2px;white-space:nowrap;background:transparent;color:#39546d}
html.ksef-simple .simple-filters button.is-active{border-bottom-color:#1764d3;background:#edf4ff;color:#114e9d}
html.ksef-simple .simple-tab-count{font-size:11px;min-width:18px;display:inline-block;text-align:center;border-radius:12px;padding:2px 5px;margin-left:3px;background:#e2ebf8;color:#345d8f;font-variant-numeric:tabular-nums}
html.ksef-simple .simple-filters button.is-active .simple-tab-count{background:#1764d3;color:#fff}
html.ksef-simple .simple-head h2{font-size:21px}
html.ksef-simple .simple-head p{margin:3px 0;color:#5f7690}
html.ksef-simple #simple-range-hint{margin:7px 0 10px}
html.ksef-simple .simple-extras{border:1px solid #e0e8f3;border-radius:10px;background:#fafcfe;padding:11px 14px;margin-top:20px}
html.ksef-simple .simple-extras summary{font-size:13px;font-weight:700;cursor:pointer;color:#395878}
html.ksef-simple .simple-extras .panel{margin-top:10px}
html.ksef-simple #simple-results .simple-table tbody tr:hover{background:#f5f9ff}
html.ksef-simple #simple-results .simple-table td{padding:10px 12px}
html.ksef-simple #simple-results .simple-table{min-width:900px}
