:root{--ink:#172b3d;--muted:#687b8c;--line:#dce5e8;--bg:#f5f7f9;--green:#087e71;--pale:#e7f4ef;--nav:#152d3d;--shadow:0 12px 42px #18344312;font-family:Inter,"Segoe UI",Arial,sans-serif;font-size:14px;color:var(--ink);background:var(--bg)}*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button,a,input,select,textarea{outline-offset:3px}button{cursor:pointer}button:disabled{opacity:.5;cursor:wait}a{color:var(--green);text-decoration:none}h1,h2,h3,p{margin-top:0}h1{font-size:29px;letter-spacing:-.7px;margin-bottom:7px}h2{font-size:18px;margin-bottom:7px}h3{font-size:15px}small,.muted{color:var(--muted)}.shell{display:grid;grid-template-columns:232px 1fr;min-height:100vh}.sidebar{background:var(--nav);color:#d6e4ec;position:fixed;inset:0 auto 0 0;width:232px;padding:30px 18px;display:flex;flex-direction:column;z-index:10}.brand{display:flex;align-items:center;gap:11px;color:white;font-size:19px;font-weight:700;margin:0 10px 30px}.brand img{width:34px;height:34px}.brand small{display:block;font-size:10px;letter-spacing:2px;font-weight:500;color:#96afbb;margin-top:3px}.company{padding:16px 12px;border:1px solid #ffffff19;border-radius:10px;margin-bottom:26px;font-size:12px}.company strong{display:block;margin-bottom:7px;color:white;line-height:1.5}.nav-label{font-size:10px;letter-spacing:1.6px;color:#7e9aa9;padding:0 12px;margin:8px 0}.nav{display:flex;flex-direction:column;gap:4px}.nav button{display:flex;align-items:center;gap:11px;border:0;background:transparent;color:#bcd0da;padding:12px;border-radius:8px;text-align:left}.nav button:hover{background:#ffffff09}.nav button.active{background:#ffffff12;color:#fff;box-shadow:inset 3px 0 #62d8b7}.ico{width:19px;height:19px;display:inline-block;vertical-align:middle;flex-shrink:0}.sidebar-bottom{margin-top:auto;padding-top:24px}.demo-pill{display:inline-flex;align-items:center;gap:7px;border-radius:5px;color:#236348;background:#e4f3e7;padding:5px 9px;font-size:10px;font-weight:800;letter-spacing:1px}.demo-pill:before{content:'';width:6px;height:6px;background:#379c69;border-radius:50%}.sidebar .demo-pill{background:#224d47;color:#9fe2cb}.sidebar-bottom p{font-size:11px;line-height:1.6;color:#8faab8;margin:12px}.main{grid-column:2;min-width:0}.topbar{height:74px;border-bottom:1px solid var(--line);background:#fff;display:flex;justify-content:space-between;align-items:center;padding:0 38px;gap:15px}.topbar .trail{font-size:12px;color:var(--muted)}.account{display:flex;align-items:center;gap:10px;font-size:12px}.avatar{width:31px;height:31px;background:#e9eff1;border-radius:50%;display:grid;place-items:center;font-weight:700;color:#3a5264}.content{padding:34px 38px 50px;max-width:1580px;margin:auto}.page-head{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:26px}.page-head p{color:var(--muted);margin:0;line-height:1.6}.button{border:1px solid var(--line);border-radius:7px;padding:10px 14px;background:#fff;color:var(--ink);font-weight:600;font-size:12px;display:inline-flex;align-items:center;justify-content:center;gap:7px;white-space:nowrap}.button:hover{background:#f3f7f7}.button.primary{background:var(--green);border-color:var(--green);color:#fff}.button.primary:hover{filter:brightness(1.08)}.button.danger{color:#ad3434}.button.ghost{background:transparent;border-color:transparent;color:var(--muted)}.button.small{padding:7px 9px;font-size:11px}.actions{display:flex;gap:9px;align-items:center;flex-wrap:wrap}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:24px}.card{border:1px solid var(--line);border-radius:10px;background:#fff;box-shadow:0 3px 10px #12344503}.stat{padding:22px}.stat-label{font-size:11px;text-transform:uppercase;letter-spacing:.9px;color:var(--muted);display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.stat-value{font-size:28px;font-weight:650;letter-spacing:-.8px;white-space:nowrap}.stat-value small{font-size:13px;font-weight:400;letter-spacing:0}.stat-foot{font-size:11px;color:var(--muted);margin-top:12px}.stat-icon{color:#56968c;background:#edf6f2;border-radius:6px;padding:5px;display:inline-flex}.split{display:grid;grid-template-columns:1.8fr 1fr;gap:20px;margin-bottom:24px}.card-head{padding:22px 23px 12px;display:flex;align-items:center;justify-content:space-between}.card-head p{font-size:11px;color:var(--muted);margin:6px 0}.chart{display:flex;height:130px;align-items:end;gap:25px;padding:14px 26px 28px;border-bottom:1px solid var(--line);margin:0 18px 20px}.bar-wrap{flex:1;display:flex;flex-direction:column;align-items:center;height:100%;justify-content:end;position:relative}.bar{width:65%;max-width:48px;background:#91d0bd;min-height:3px;border-radius:4px 4px 0 0}.bar-wrap:last-child .bar{background:var(--green)}.bar-wrap label{position:absolute;top:calc(100% + 9px);font-size:10px;color:var(--muted)}.status-line{display:flex;gap:12px;align-items:center;padding:15px 22px;border-bottom:1px solid #edf1f2}.status-line:last-child{border-bottom:0}.status-line .ico{color:var(--green)}.status-line strong{display:block;font-size:12px;margin-bottom:4px}.status-line small{font-size:11px}.status-line .right{margin-left:auto}.toolbar{padding:18px 22px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:15px;align-items:center;flex-wrap:wrap}.tabs{display:flex;gap:6px;flex-wrap:wrap}.tabs button{border:0;background:transparent;padding:8px 10px;border-radius:5px;color:var(--muted);font-size:12px}.tabs button.active{color:var(--green);background:var(--pale);font-weight:600}.search{width:240px;max-width:100%;font-size:12px!important}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;white-space:nowrap;text-align:left}th{font-size:10px;letter-spacing:.6px;color:#728493;text-transform:uppercase;background:#fafcfc;font-weight:600;padding:13px 20px;border-bottom:1px solid var(--line)}td{font-size:12px;padding:17px 20px;border-bottom:1px solid #edf1f3;vertical-align:middle}tr:last-child td{border-bottom:0}tr.clickable:hover{background:#f7fbf9;cursor:pointer}td small{display:block;font-size:10px;margin-top:5px}td strong{font-weight:650}.money{text-align:right;font-variant-numeric:tabular-nums}.badge{display:inline-block;font-size:10px;font-weight:600;border-radius:5px;padding:5px 8px;background:#edf1f4;color:#637484}.badge.green{background:#e7f4ec;color:#2d8558}.badge.orange{background:#fff2d9;color:#a97c20}.badge.red{background:#fceceb;color:#b54747}.badge.blue{background:#e8f1fc;color:#4878ad}.empty{text-align:center;padding:55px 20px;color:var(--muted)}.empty strong{display:block;color:var(--ink);font-size:16px;margin-bottom:8px}.panel{padding:25px}.field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:17px}.field-grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}.field-grid.four{grid-template-columns:repeat(4,minmax(0,1fr))}.field-grid .full{grid-column:1/-1}label.field{display:flex;flex-direction:column;gap:7px;font-size:11px;font-weight:600;color:#526779}input,select,textarea{border:1px solid #d7e1e5;border-radius:6px;background:white;padding:10px 11px;color:var(--ink);width:100%;font-size:13px;min-width:0}input:focus,select:focus,textarea:focus{outline:2px solid #087e7125;border-color:var(--green)}textarea{resize:vertical;min-height:75px;line-height:1.5}input[type=checkbox]{width:auto;accent-color:var(--green)}input[type=color]{height:40px;padding:4px;width:80px}.check{display:flex;align-items:center;gap:8px;font-size:12px;line-height:1.5}.hint{font-size:11px;line-height:1.6;color:var(--muted);margin-top:6px}.notice{border:1px solid #cce3dc;background:#edf7f2;color:#406d5d;padding:14px 17px;border-radius:7px;font-size:12px;line-height:1.7;margin-bottom:20px}.notice.warn{border-color:#eddbad;background:#fff8e6;color:#8d762d}.notice.error{border-color:#efc5c5;background:#fff0f0;color:#a33b3b}.section-title{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);padding-bottom:12px;margin:25px 0 18px}.section-title:first-child{margin-top:0}.section-title h3{margin:0}.settings-layout{display:grid;grid-template-columns:minmax(420px,1.3fr) minmax(270px,.8fr);gap:24px}.paper-preview{padding:30px;background:#fff;aspect-ratio:210/297;border:1px solid var(--line);box-shadow:var(--shadow);font-size:10px;position:sticky;top:25px;max-height:750px;overflow:hidden}.paper-preview img{max-width:120px;max-height:55px;margin-bottom:16px}.paper-preview h2{font-size:23px;color:var(--green);margin:22px 0 10px}.paper-line{height:9px;background:#eef2f2;margin:10px 0;max-width:85%}.paper-line.short{max-width:40%}.paper-footer{margin-top:45px;border-top:1px solid var(--line);padding-top:15px;white-space:pre-wrap}.logo-box{border:1px dashed #b6ccca;border-radius:7px;padding:18px;background:#f7fbf9}.logo-box img{display:block;max-width:160px;max-height:60px;margin-bottom:10px}.block{margin-bottom:24px}.error-text{color:#b33e3e;font-size:12px;margin:10px 0;line-height:1.6}dialog{border:0;border-radius:12px;padding:0;width:min(1080px,96vw);max-height:94vh;box-shadow:0 30px 100px #0b25393f;color:var(--ink)}dialog::backdrop{background:#102b3c66;backdrop-filter:blur(3px)}.modal-head{padding:22px 26px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;background:white;z-index:2}.modal-head h2{margin:0}.modal-body{padding:24px 26px}.modal-footer{padding:18px 26px;border-top:1px solid var(--line);display:flex;gap:10px;justify-content:flex-end;position:sticky;bottom:0;background:#fff;z-index:2}.line-editor{min-width:720px}.line-editor th,.line-editor td{padding:8px 5px}.line-editor input,.line-editor select{padding:9px 6px}.line-editor .name-cell{width:30%}.line-editor .narrow{width:9%}.line-editor .rate-cell{width:12%}.line-editor .x{width:30px}.line-editor .row-extra td{padding-top:0}.row-extra .extras{display:flex;gap:8px;align-items:center}.row-extra input{max-width:165px;font-size:11px}.total-strip{background:#eff6f4;padding:15px 18px;border-radius:7px;display:flex;justify-content:flex-end;gap:28px;margin-top:15px;font-size:13px}.total-strip strong{font-size:18px;margin-left:7px}.custom-row{display:grid;grid-template-columns:1fr 1.5fr auto auto;gap:9px;margin-bottom:10px;align-items:center}.detail-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:25px}.detail-values{display:grid;grid-template-columns:1fr 1fr;gap:18px}.detail-values label{display:block;font-size:10px;text-transform:uppercase;color:var(--muted);margin-bottom:7px}.detail-values strong{font-size:13px;overflow-wrap:anywhere}.timeline{border-left:2px solid #d9e8e1;padding-left:18px;margin:20px 4px}.timeline div{padding-bottom:20px;font-size:12px;position:relative}.timeline div:before{position:absolute;content:'';left:-24px;top:3px;width:9px;height:9px;border:2px solid white;border-radius:50%;background:#70ae99}.timeline small{display:block;margin-bottom:5px}.login{min-height:100vh;display:grid;grid-template-columns:1fr 1fr;background:white}.login-art{background:var(--nav);color:#fff;padding:10vw 7vw;display:flex;flex-direction:column;justify-content:center}.login-art h1{font-size:44px;line-height:1.2;max-width:460px;margin:35px 0 20px}.login-art p{color:#a4bdc9;line-height:1.8;max-width:400px}.login-form{display:grid;place-items:center;padding:40px}.login-form form{width:100%;max-width:340px}.login-form .field{margin:20px 0}.login-form h2{font-size:26px;margin-bottom:12px}.login-form .button{width:100%;margin-top:8px}.loading{padding:70px;text-align:center;color:var(--muted)}#toast{position:fixed;right:24px;bottom:24px;background:#183d35;color:white;border-radius:9px;padding:15px 20px;box-shadow:var(--shadow);z-index:100;max-width:480px;display:none;line-height:1.6}#toast.error{background:#923d3d}.mobile-brand{display:none}.nowrap{white-space:nowrap}.hidden{display:none!important}.codes{font-family:Consolas,monospace;font-size:11px;overflow-wrap:anywhere;white-space:normal}.invoice-link{color:var(--green);font-weight:650}.summary-note{padding:15px 22px;font-size:10px;color:var(--muted);border-top:1px solid var(--line)}.filters{display:flex;gap:10px;align-items:center}.filters input{width:140px;font-size:12px}.user-table .button{font-size:10px}.help-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:18px}.help-grid p,.help-grid li{font-size:12px;line-height:1.8}.file-input{padding:8px}.footer-actions{position:sticky;bottom:0;background:#fffffff0;padding:15px 0;margin-top:20px;display:flex;gap:10px;border-top:1px solid var(--line)}
@media(min-width:1700px){.content{padding-top:45px}.stats{gap:22px}.stat{padding:28px}}@media(max-width:1150px){.sidebar{width:200px}.shell{grid-template-columns:200px 1fr}.content{padding:26px 22px}.topbar{padding:0 22px}.stats{grid-template-columns:repeat(2,1fr)}.settings-layout{grid-template-columns:1fr}.paper-preview{display:none}.split{grid-template-columns:1.4fr 1fr}.stat-value{font-size:26px}}@media(max-width:760px){.shell{display:block}.sidebar{position:static;width:100%;padding:15px}.sidebar .brand{margin:0}.company,.nav-label,.sidebar-bottom{display:none}.nav{flex-direction:row;overflow:auto;margin-top:15px}.nav button{padding:9px;white-space:nowrap;font-size:11px}.nav button.active{box-shadow:inset 0 -2px #62d8b7}.nav .ico{display:none}.main{width:100%}.topbar{height:54px;padding:0 16px}.topbar .trail{display:none}.content{padding:25px 15px}.page-head{align-items:flex-start}.page-head h1{font-size:24px}.page-head p{font-size:12px}.stats{gap:10px}.stat{padding:16px}.stat-label{font-size:9px;letter-spacing:0}.stat-value{font-size:24px}.stat-icon{display:none}.split{grid-template-columns:1fr}.field-grid,.field-grid.three,.field-grid.four{grid-template-columns:1fr 1fr}.detail-grid{grid-template-columns:1fr}.help-grid{grid-template-columns:1fr}.custom-row{grid-template-columns:1fr 1fr}.toolbar{padding:13px;align-items:stretch}.search{width:100%}.filters{flex-wrap:wrap}.filters input{width:120px}.modal-head,.modal-body,.modal-footer{padding:16px}.modal-footer{flex-wrap:wrap}.total-strip{gap:12px;flex-wrap:wrap}.login{grid-template-columns:1fr}.login-art{display:none}.login-form{padding:24px}.actions{gap:6px}.button{padding:9px 11px}th,td{padding:13px}.section-title{margin-top:23px}.account{margin-left:auto}.chart{gap:10px}.page-head .actions{max-width:150px;justify-content:end}.card-head{padding:18px}}

.history-tabs{margin-bottom:22px}.history-banner{display:flex;gap:20px;align-items:center;justify-content:space-between}.history-pagination{padding:16px 20px;display:flex;gap:16px;justify-content:space-between;align-items:center;font-size:12px;color:var(--muted)}.history-filters{align-items:end;justify-content:flex-start}.history-filters .field{max-width:170px}.history-filters .search{min-width:240px;flex:1}.history-lines td:first-child{white-space:normal;min-width:220px;max-width:440px}.history-details{margin-top:20px;border:1px solid var(--line);padding:12px;border-radius:7px}.history-details summary{cursor:pointer;font-size:12px}.wrap{white-space:pre-wrap;overflow-wrap:anywhere}.button:disabled{opacity:.45;cursor:default}@media(max-width:760px){.history-banner,.history-pagination{flex-wrap:wrap}.history-filters .search{min-width:160px}.history-filters .field{flex:1}}

/* Compact tables */
th,
.line-editor th {
  padding: 2px 6px;
  line-height: 14px;
}
td,
.line-editor td {
  padding: 1px 6px;
  line-height: 16px;
}
td small {
  display: block;
  margin: 0;
  line-height: 12px;
}
td small:empty { display: none; }
table .badge {
  padding: 1px 5px;
  line-height: 14px;
}
table .button,
table .button.small {
  min-height: 20px;
  padding: 1px 6px;
  font-size: 11px;
  line-height: 16px;
  gap: 4px;
}
table .ico { width: 14px; height: 14px; }
table input,
table select,
.line-editor input,
.line-editor select {
  height: 20px;
  padding: 1px 5px;
  font-size: 11px;
  line-height: 16px;
}
table input[type=checkbox],
table input[type=radio] { width: auto; height: auto; margin: 0; }
table .actions { gap: 4px; }
.startup-error{max-width:620px;margin:12vh auto;padding:32px;line-height:1.7}.startup-error h1{font-size:25px}@media(max-width:680px){.startup-error{margin:24px 16px;padding:24px}}
#toast{pointer-events:none}
/* Contrast for compact table text (WCAG 2.2 SC 1.4.3). */
table th,table small,table .muted{color:#586b7b}
table .badge{color:#4d6275}table .badge.green{color:#226b43}table .badge.orange{color:#805b13}table .badge.red{color:#9c3030}table .badge.blue{color:#285d95}
.pdf-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:10px}.pdf-toolbar label{display:flex;align-items:center;gap:6px;font-size:12px}.pdf-toolbar input{width:68px;padding:6px}.pdf-toolbar select{padding:6px;max-width:230px}.pdf-status{font-size:12px;color:#425768;margin:6px 0}.pdf-status[role=alert]{color:#9e2929}.pdf-stage{overflow:auto;max-height:65vh;min-height:200px;background:#e8edf1;padding:16px;text-align:center}.pdf-stage canvas{display:block;margin:auto;background:white;box-shadow:0 1px 5px #0002}.pdf-stage canvas[hidden]{display:none}.pdf-transcript{margin-top:10px;font-size:12px}.pdf-transcript pre{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;max-height:240px;overflow:auto}

/* Task 00: keep selection visible while the source table scrolls. */
dialog[open]:has(.history-customer-picker){display:flex;flex-direction:column;height:min(820px,94dvh);max-height:94dvh;overflow:hidden}
dialog:has(.history-customer-picker) .modal-head,dialog:has(.history-customer-picker) .modal-footer{position:static;flex-shrink:0}
dialog:has(.history-customer-picker) .modal-body{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden;padding:12px 16px}
dialog:has(.history-customer-picker) .history-filters{flex-shrink:0;padding:8px 0;gap:8px}
dialog:has(.history-customer-picker) #history-catalog-results{display:flex;flex-direction:column;flex:1;min-height:0}
dialog:has(.history-customer-picker) .history-pagination{flex-shrink:0;padding:10px 8px}
.history-picker-table{width:100%;max-width:100%;min-width:0;min-height:0;flex:1;overflow:auto;scrollbar-gutter:stable}
.history-picker-table table{min-width:620px}
.history-picker-table thead{position:sticky;top:0;z-index:2}
.history-picker-table th:first-child,.history-picker-table td:first-child{position:sticky;left:0;z-index:1;background:#fff;border-right:1px solid var(--line);width:74px;min-width:74px}
.history-picker-table th:first-child{background:#fafcfc;z-index:3}
.history-picker-table:focus-visible{outline:2px solid var(--green);outline-offset:2px}
@media(max-height:450px){dialog:has(.history-customer-picker) .modal-head,dialog:has(.history-customer-picker) .modal-footer{padding:10px 16px}}

/* Zgłoszenie 04: bank accounts use the existing form controls. */
.bank-settings-row{display:grid;grid-template-columns:minmax(200px,2fr) minmax(140px,1fr) auto auto;gap:10px;align-items:end;margin-bottom:10px}.bank-settings-row .check{padding-bottom:10px}@media(max-width:650px){.bank-settings-row{grid-template-columns:minmax(0,1fr) auto}.bank-settings-row .field{grid-column:1/-1}}

/* Zgłoszenia 07–08: NIP first, country sized for a short code. */
.buyer-nip-start{display:flex;align-items:end;gap:10px}.buyer-nip-start .field{width:220px;max-width:55%}
.buyer-fields{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr) 84px minmax(0,1fr)}
.buyer-fields .field:has([name="buyer.country"]){width:84px;max-width:100%}
[name="buyer.country"]{text-transform:uppercase}
#buyer-gus-status{font-size:13px;margin:8px 0;overflow-wrap:anywhere}
#buyer-gus-status .button{white-space:normal;text-align:left}
@media(max-width:750px){.buyer-fields{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.buyer-fields .field:has([name="buyer.name"]),.buyer-fields .field:has([name="buyer.address"]){grid-column:1/-1}}

/* Zgłoszenia 09–10: shared invoice currency and field-specific errors. */
.line-editor .currency-cell{width:84px;min-width:84px}.line-editor .currency-cell select{width:84px;min-width:84px;padding-left:7px;padding-right:20px}
#invoice-form .invalid-field{border:2px solid #bd2323;background:#fff1f1;outline-color:#bd2323}
#invoice-form .field-error{display:block;color:#a31b1b;font-size:12px;line-height:1.35;margin-top:4px;white-space:normal}


/* Series and document currency controls. */
.field-grid.invoice-head-with-series{grid-template-columns:minmax(0,1.15fr) minmax(0,1.35fr) repeat(2,minmax(0,1fr));align-items:end}
.invoice-series-control{display:flex;align-items:end;gap:6px;min-width:0}
.invoice-series-control .field{flex:1;min-width:0}
.invoice-series-control .button{flex-shrink:0}
.invoice-series-new:not([hidden]){display:flex;gap:8px;align-items:end;flex-wrap:wrap;margin-top:10px}
.invoice-series-new .field{min-width:150px;max-width:100%}
.invoice-series-new .error-text{margin:0;flex-basis:100%}
.invoice-series-new .error-text:empty{display:none}
.line-editor [data-invoice-currency]:disabled{opacity:1;color:var(--ink);background:#f2f6f7}
@media(max-width:850px){.field-grid.invoice-head-with-series{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:500px){.field-grid.invoice-head-with-series{grid-template-columns:1fr}}

input[data-number], input[type="number"] {
 text-align: right;
 font-variant-numeric: tabular-nums;
}
.line-editor [data-number="price"] { min-width: 108px; }
#editor-totals {
 align-items: baseline;
 flex-wrap: wrap;
 gap: 8px 24px;
 text-align: right;
 font-variant-numeric: tabular-nums;
}
#editor-totals strong { display: inline-block; }
#editor-totals .error-text { flex-basis: 100%; margin: 0; }
.line-editor { min-width: 925px; }
.line-editor .name-cell { width: 22%; }
.line-editor .line-value { min-width: 96px; }
.line-editor .line-value span { font-weight: 600; }
.discount-details:not([hidden]) {
 display: flex;
 flex-wrap: wrap;
 gap: 6px 16px;
 max-width: 790px;
 margin: 7px 0 3px;
 padding: 6px 10px;
 border-radius: 5px;
 background: var(--pale);
}
.discount-details strong { margin-left: 4px; }
#user-form { display: grid; gap: 12px; }
#user-form .error-text:empty { display: none; }
#user-form .invalid-field { border-color: #bd2323; background: #fff1f1; }
#user-form .field-error { color: #a31b1b; font-size: 12px; }
.buyer-nip-start { flex-wrap: wrap; }
.vat-exemption-custom:not([hidden]) { display: grid; gap: 6px; margin-top: 6px; }
#invoice-series-hint:empty { display: none; }
#billed-buyer-results { margin-top: 12px; }
#billed-buyer-results .history-picker-table { max-height: 56vh; }
.billed-address { white-space: pre-line; min-width: 170px; }
.due-field { position: relative; }
.due-field input::-webkit-calendar-picker-indicator { display: none; }
.due-field [data-action="due-open"] { margin-top: 4px; }
#due-offset-label:empty { display: none; }
#due-calendar:not([hidden]) {
 position: absolute;
 inset: 100% auto auto 0;
 z-index: 5;
 width: min(330px,80vw);
 padding: 12px;
 background: #fff;
 border: 1px solid var(--line);
 border-radius: 8px;
 box-shadow: var(--shadow);
}
.due-calendar-head { display: flex; align-items: center; justify-content: space-between; }
.due-calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 3px; text-align: center; margin: 8px 0; }
.due-calendar-grid .button { padding: 4px 0; }
.due-shortcuts { gap: 3px; }
#due-error:empty { display: none; }
.document-type { max-width: 270px; margin-bottom: 12px; }
#invoice-form .actions[hidden] { display: none; }
#correction-picker-results { margin-top: 12px; }

/* The editor scrolls independently of the title and document actions. */
#modal[open]:has(> .modal-body > #invoice-form) {
 display: flex;
 flex-direction: column;
 overflow: hidden;
}
#modal:has(> .modal-body > #invoice-form) > :is(.modal-head,.modal-footer) {
 position: static;
 flex: none;
 padding: 8px 16px;
}
#modal:has(> .modal-body > #invoice-form) > .modal-head h2 { font-size: 18px; }
#modal:has(> .modal-body > #invoice-form) > .modal-body {
 min-height: 0;
 overflow: auto;
 padding: 10px 16px;
}
#invoice-form {
 display: grid;
 gap: 6px;
 min-width: 0;
}
#invoice-form .notice { margin: 0; padding: 4px 8px; font-size: 11px; line-height: 1.4; }
#invoice-form .field-grid { gap: 5px 10px; }
#invoice-form .invoice-document-grid.invoice-head-with-series {
 grid-template-columns: minmax(0,1fr) minmax(0,1.12fr) minmax(0,1.4fr) repeat(2,minmax(0,1fr));
 align-items: end;
}
#invoice-form .invoice-document-grid.three { grid-template-columns: repeat(4,minmax(0,1fr)); }
#invoice-form .invoice-document-grid .document-type { max-width: none; margin: 0; }
#invoice-form .field { min-width: 0; gap: 2px; line-height: 1.3; }
#invoice-form :is(input:not([type="checkbox"],[type="radio"]),select,textarea) {
 min-height: 28px;
 padding: 3px 7px;
}
#invoice-form textarea { min-height: 43px; }
#invoice-form .hint { margin: 3px 0 0; line-height: 1.35; }
#invoice-form .section-title {
 min-height: 25px;
 margin: 0 0 5px;
 padding: 3px 0;
 border-bottom: 0;
 gap: 6px;
}
#invoice-form .section-title h3 { font-size: 13px; }
#invoice-form .button.small { padding: 4px 7px; min-height: 27px; }
#invoice-form .button.small .ico { width: 14px; height: 14px; }
#invoice-form .invoice-section { min-width: 0; border-top: 1px solid var(--line); }
#invoice-form .invoice-section-title .actions { justify-content: flex-end; gap: 6px; }
#invoice-form .invoice-section-title .search { width: 198px; }
#invoice-form .invoice-buyer-layout {
 display: grid;
 grid-template-columns: minmax(270px,1fr) minmax(0,1.7fr);
 gap: 6px 14px;
 padding-top: 4px;
}
#invoice-form .buyer-nip-start { gap: 5px; }
#invoice-form .buyer-nip-start .field { flex: 1 0 112px; width: auto; max-width: none; }
#invoice-form #buyer-gus-status { margin: 4px 0 0; }
#invoice-form #buyer-gus-status:empty, #invoice-form #editor-error:empty { display: none; }
#invoice-form .buyer-fields { grid-template-columns: repeat(6,minmax(0,1fr)); }
#invoice-form .buyer-fields .field:has([name="buyer.country"]) { width: auto; }
#invoice-form .buyer-fields .field:has([name="buyer.name"],[name="buyer.address"],[name="buyer.email"]) { grid-column: span 3; }
#invoice-form .buyer-fields .field:has([name="buyer.tax_id"]) { grid-column: span 2; }
#invoice-form .invoice-lines .section-title {
 background: #f4f8f8;
 margin: 0;
 padding: 3px 6px;
 border-bottom: 1px solid var(--line);
}
#invoice-form .invoice-line-table {
 border: 1px solid var(--line);
 border-top: 0;
}
#invoice-form .line-editor .row-extra td { padding-bottom: 2px; }
#invoice-form .line-editor .row-extra input { min-height: 25px; }
#invoice-form .invoice-lines-tail {
 display: flex;
 align-items: start;
 justify-content: space-between;
 gap: 5px 10px;
 margin-top: 4px;
}
#invoice-form #editor-totals {
 display: grid;
 grid-template-columns: minmax(0,1fr);
 justify-content: stretch;
 gap: 0;
 min-width: min(250px,100%);
 margin: 0;
 padding: 2px 7px;
 border-radius: 4px;
 font-size: 12px;
}
#invoice-form #editor-totals > span {
 display: flex;
 justify-content: space-between;
 gap: 10px;
 padding: 0;
 border-bottom: 1px solid var(--line);
}
#invoice-form #editor-totals > span:last-of-type { border-bottom: 0; }
#invoice-form #editor-totals strong { font-size: 13px; margin: 0; }
#invoice-form #editor-totals .error-text { max-width: 330px; text-align: left; }
#invoice-form .invoice-payment-fields {
 grid-template-columns: minmax(0,1fr) minmax(0,1.05fr) minmax(0,1.5fr) minmax(0,.8fr) minmax(0,1fr) minmax(0,1.25fr);
 align-items: start;
}
#invoice-form .due-field [data-action="due-open"] { margin-top: 2px; min-height: 22px; padding-block: 2px; }
#invoice-form #due-calendar:not([hidden]) { inset: auto auto calc(100% + 4px) 0; }
#invoice-form .invoice-payment-flags { margin: 5px 0; gap: 4px 12px; }
#invoice-form .invoice-extra-fields { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 5px; }
#invoice-form .invoice-custom-fields .custom-row { margin-bottom: 4px; gap: 6px; }
#invoice-form .invoice-custom-fields > .hint { display: inline-block; margin-inline-start: 6px; }
#invoice-form .invoice-custom-fields:has(#invoice-fields:empty) {
 display: flex;
 align-items: center;
 flex-wrap: wrap;
 gap: 3px 6px;
 padding-top: 3px;
}
#invoice-form .invoice-custom-fields:has(#invoice-fields:empty) .section-title { margin: 0; }
#invoice-form #invoice-fields:empty { display: none; }

@media (max-width: 1010px) {
 #invoice-form .invoice-payment-fields { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 850px) {
 #invoice-form .invoice-document-grid.invoice-head-with-series { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 720px) {
 #invoice-form .invoice-buyer-layout { grid-template-columns: minmax(0,1fr); }
 #invoice-form .invoice-document-grid:is(.three,.invoice-head-with-series) { grid-template-columns: repeat(2,minmax(0,1fr)); }
 #invoice-form .section-title { flex-wrap: wrap; }
 #invoice-form .invoice-section-title .actions { justify-content: flex-start; }
}
@media (max-width: 520px) {
 #modal:has(> .modal-body > #invoice-form) > :is(.modal-head,.modal-footer,.modal-body) { padding-inline: 9px; }
 #modal:has(> .modal-body > #invoice-form) > .modal-footer { flex-wrap: wrap; gap: 4px; }
 #modal:has(> .modal-body > #invoice-form) > .modal-footer .button { padding: 7px 8px; }
 #invoice-form .invoice-payment-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
 #invoice-form .due-field:has(#due-calendar:not([hidden])) { grid-column: 1/-1; }
 #invoice-form #due-calendar:not([hidden]) { position: static; width: 100%; margin-top: 4px; }
 #invoice-form .invoice-extra-fields { grid-template-columns: minmax(0,1fr); }
 #invoice-form .invoice-lines-tail { flex-direction: column; }
 #invoice-form #editor-totals { align-self: stretch; }
 #invoice-form .buyer-fields .field:has([name="buyer.name"],[name="buyer.address"],[name="buyer.email"]) { grid-column: 1/-1; }
 #invoice-form .buyer-fields .field:has([name="buyer.country"]) { grid-column: span 2; }
 #invoice-form .buyer-fields .field:has([name="buyer.tax_id"]) { grid-column: span 4; }
 #invoice-form .invoice-custom-fields .custom-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

.invoice-attachments { list-style: none; margin: 0; padding: 0; }
.invoice-attachments li { display: flex; align-items: center; gap: 10px; margin: 5px 0; }
.invoice-attachments li span { overflow-wrap: anywhere; }
.invoice-buyer-type { max-width: 210px; margin-bottom: 8px; }
.invoice-buyer-layout [hidden] { display: none; }

/* GRIMP shell: current published palette and dimensions, with the owner's
   live stylesheet loaded before this app-specific layout. */
:root {
  --ink: #292829;
  --muted: #686668;
  --line: #d9d6d0;
  --bg: var(--panel-page-bg, #f5f4f0);
  --green: #356b53;
  --pale: #d7e8df;
  --nav: #424041;
  --shadow: none;
  color: var(--ink);
  background: var(--bg);
}
body { background: var(--bg); }
.ksef-shell { display: block; --sidebar-width: 234px; min-height: 100vh; }
.ksef-shell .sidebar {
  width: var(--sidebar-width);
  padding: 25px 12px 16px;
  background: #efeee9;
  border-right: 1px solid var(--line);
  color: var(--ink);
  overflow-y: auto;
  z-index: 31;
}
.ksef-shell .brand { align-items: center; gap: 11px; margin: 0 8px 20px; color: var(--ink); }
.ksef-shell .brand-logo { width: 40px; height: 40px; flex: none; display: block; }
.ksef-shell .brand strong { display: block; font-size: 21px; font-weight: 720; letter-spacing: -.7px; }
.ksef-shell .brand small { display: block; color: #686668; font-size: 10.5px; letter-spacing: .05px; margin-top: 3px; }
.ksef-shell .company {
  margin: 0 8px 17px; padding: 9px 10px;
  background: #faf9f6; border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font-size: 10px; line-height: 1.35;
}
.ksef-shell .company strong { color: var(--ink); margin-bottom: 2px; font-size: 11px; }
.ksef-shell .nav-label { padding: 0 11px; margin: 0 0 11px; color: #928e8e; font-size: 9px; font-weight: 650; letter-spacing: 1.4px; }
.ksef-shell .nav { display: flex; flex-direction: column; gap: 2px; overflow: visible; margin: 0; }
.ksef-shell .section-toggle {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 31px;
  padding: 5.5px 10px; text-align: left; border: 0; border-radius: 6px;
  background: var(--shared-section-bg, #e5e5e8);
  color: #424041; font-size: 12.5px; line-height: 1.3;
}
.ksef-shell .section-toggle .ico { width: 16px; height: 16px; color: #7b8580; }
.ksef-shell .section-toggle:hover { color: var(--green); filter: brightness(.97); }
body .ksef-shell .section-toggle.active {
  background: color-mix(in srgb, var(--shared-section-bg, #e5e5e8) 86%, #8e8b87) !important;
  color: #295c3c !important;
  box-shadow: inset 2px 0 0 #356b53;
}
.ksef-shell .section-toggle.active .ico { color: #356b53; }
.ksef-shell .sidebar-bottom { margin-top: auto; padding: 15px 8px 0; border-top: 1px solid var(--line); }
.ksef-shell .sidebar-bottom p { color: #87817e; margin: 8px 0 0; font-size: 10px; }
.ksef-shell .sidebar .demo-pill { background: #d7e8df; color: #295c3c; }
.ksef-shell .main { margin-left: var(--sidebar-width); min-width: 0; }
.ksef-shell.menu-collapsed .sidebar { transform: translateX(-100%); visibility: hidden; pointer-events: none; }
.ksef-shell.menu-collapsed .main { margin-left: 0; }
.ksef-shell .topbar {
  height: 53px; padding: 0 25px; position: sticky; top: 0; z-index: 20;
  background: #faf9f6; border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.ksef-shell .topbar::after {
  content: ""; position: absolute; height: 2px; left: 0; right: 0; bottom: -2px;
  background: linear-gradient(90deg,#f4c248 0%,#e98659 25%,#c675aa 52%,#5896ce 77%,#60a878 100%);
}
.ksef-shell .topbar .trail { display: flex; align-items: center; gap: 11px; min-width: 0; color: #8a8587; font-size: 11px; }
.ksef-shell .topbar .trail strong { font-weight: 500; color: #424041; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ksef-shell .crumb-slash { color: #b9b4b2; }
.ksef-shell .menu-toggle {
  border: 0; padding: 6px 2px; background: none; color: #8a8587;
  white-space: nowrap; font-size: 11px; cursor: pointer;
}
.ksef-shell .menu-toggle:hover { color: #356b53; }
.ksef-shell .topbar .actions { flex-wrap: nowrap; gap: 12px; }
.ksef-shell .topbar .demo-pill { padding: 4px 7px; }
.ksef-shell .topbar .account { font-size: 11px; white-space: nowrap; }
.ksef-shell .topbar .avatar { width: 27px; height: 27px; background: #e8e5de; color: #424041; }
.ksef-shell .ksef-section-tabs {
  position: sticky; top: 53px; z-index: 19; display: flex; align-items: end;
  gap: 3px; min-height: 41px; padding: 0 25px;
  overflow-x: auto; background: var(--bg); border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.ksef-shell .ksef-tab {
  position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 10px 13px 8px; border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; background: var(--shared-tab-bg, #fff);
  color: #686668; font-size: 12px; white-space: nowrap;
}
.ksef-shell .ksef-tab:hover { color: #295c3c; }
.ksef-shell .ksef-tab.active { color: #292829; font-weight: 600; border-bottom-color: #bb5261; }
.ksef-shell .ksef-tab .tab-number { color: #99908f; font-size: 10px; font-weight: 400; }
.ksef-shell .content { max-width: 1900px; padding: 24px 25px 30px; margin: 0 auto; }
.ksef-shell .page-head { margin-bottom: 22px; }
.ksef-shell .page-head h1 { font-size: 28px; font-weight: 650; letter-spacing: -1px; line-height: 1.22; }
.ksef-shell .page-head p { font-size: 11.5px; color: #85807e; }
.ksef-shell .card { border-color: var(--line); border-radius: 8px; box-shadow: none; }
.ksef-shell th { background: #efeee9; color: #4c4a49; text-transform: none; letter-spacing: 0; }
.ksef-shell td { color: #292829; }
.ksef-shell .button { border-color: #bdb9b2; color: #424041; box-shadow: 0 1px 2px #20252c20; font-weight: 400; }
body #app .button.primary, body #modal .button.primary {
  background: #356b53 !important; border-color: #356b53 !important;
  color: #fff !important; box-shadow: 0 1px 2px #20252c20 !important;
}
body #app .button.primary:hover, body #modal .button.primary:hover { background: #295c3c !important; }
body #app .content .button.ghost { background: none !important; border-color: transparent !important; box-shadow: none !important; color: #356b53 !important; }
.ksef-shell input:not([type=checkbox]):not([type=radio]), .ksef-shell select { min-height: 34px; }
.ksef-shell .nav-backdrop { display: none; }
.login { background: var(--bg); }
.login-art { background: #efeee9; color: #292829; }
.login-art p { color: #686668; }
.login-art .brand { color: #292829; }
.login-form { background: var(--bg); }
.login-form form { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 28px; box-shadow: 0 6px 25px #42404110; }
@media (max-width: 1150px) {
  .ksef-shell { --sidebar-width: 212px; }
  .ksef-shell .content { padding: 21px 20px 30px; }
  .ksef-shell .topbar, .ksef-shell .ksef-section-tabs { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 760px) {
  .ksef-shell { --sidebar-width: 234px; }
  .ksef-shell .sidebar { position: fixed; width: var(--sidebar-width); transform: translateX(-100%); visibility: hidden; pointer-events: none; box-shadow: 20px 0 70px #17243515; }
  .ksef-shell.mobile-open .sidebar { transform: translateX(0); visibility: visible; pointer-events: auto; }
  .ksef-shell .main, .ksef-shell.menu-collapsed .main { margin-left: 0; width: 100%; }
  .ksef-shell.mobile-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 30; width: 100%; border: 0; background: #10213b77; }
  .ksef-shell .topbar { height: 50px; padding: 0 17px; }
  .ksef-shell .topbar .crumb, .ksef-shell .topbar .crumb-slash { display: none; }
  .ksef-shell .topbar .trail strong { max-width: 140px; }
  .ksef-shell .topbar .account { display: none; }
  .ksef-shell .topbar .actions { gap: 6px; }
  .ksef-shell .topbar .button { padding: 6px 8px; font-size: 10px; }
  .ksef-shell .ksef-section-tabs { top: 50px; padding: 0 17px; }
  .ksef-shell .content { padding: 22px 17px 30px; }
  .ksef-shell .page-head h1 { font-size: 24px; }
  .login-art { display: none; }
  .login-form form { padding: 24px; }
}

/* GRIMP uses one centered login card. Keep the KSeF DEMO warning in the card. */
.login { grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px; }
.login-art { display: none; }
.login-form { display: block; width: min(100%, 380px); padding: 0; background: transparent; }
.login-form form { width: 100%; max-width: none; padding: 24px; box-shadow: none; }
.login-form h2 { font-size: 23px; letter-spacing: -.4px; margin-bottom: 10px; }
.login-form .field { margin: 15px 0; font-size: 13px; }
.login-form .field input { min-height: 36px; }
.login-form .login-demo { margin: 0 0 14px; }
.login-form .button.primary { width: auto; min-height: 36px; margin: 8px auto 0; display: flex; }
body #app .login-form .button.primary {
  background: linear-gradient(180deg, #f0f0f2, #dedee2) !important;
  border-color: #b8b8be !important; color: #30343b !important;
  box-shadow: inset 0 1px 0 #ffffffcc, 0 1px 2px #20252c40 !important;
}
.login-form .hint { margin: 18px 0 0; font-size: 11px; line-height: 1.5; }

/* GRIMP StandardTable: same geometry, column controls and one filter toolbar. */
.standard-table-frame { min-width: 0; max-width: 100%; }
.standard-table-scroll { overflow: auto; max-width: 100%; background: #fff; border: 1px solid var(--shared-border, #d9d6d0); border-radius: 4px; }
.standard-table.standard-table { width: 100%; border-collapse: collapse; text-align: left; color: var(--shared-text, #424041); font-size: var(--shared-table-size, 12px); font-variant-numeric: tabular-nums; }
.standard-table.standard-table > thead > tr > th,
.line-editor > thead > tr > th {
  height: var(--shared-head-height, 27px); padding: var(--shared-cell-y, 4px) var(--shared-cell-x, 8px);
  background: #efeee9; color: #292829; border-bottom: 1px solid var(--shared-border, #d9d6d0);
  font-size: var(--shared-table-size, 12px); line-height: 1.2; font-weight: 600;
  text-transform: none; letter-spacing: 0; white-space: nowrap; vertical-align: middle;
}
.standard-table.standard-table > tbody > tr > td {
  height: var(--shared-row-height, 29px); padding: var(--shared-cell-y, 4px) var(--shared-cell-x, 8px);
  border-bottom: 1px solid var(--shared-border, #d9d6d0); color: #292829;
  font-size: var(--shared-table-size, 12px); line-height: 1.3; vertical-align: middle;
}
.standard-table.standard-table > tbody > tr:last-child > td { border-bottom: 0; }
.standard-table.standard-table > tbody > tr[hidden] { display: none; }
.standard-column-head { display: flex; align-items: center; justify-content: flex-start; gap: 7px; white-space: nowrap; }
.standard-table.standard-table thead th .standard-column-head button.standard-sort-button,
.standard-table.standard-table thead th .standard-column-head button.standard-filter-button {
  display: flex !important; align-items: center !important; justify-content: flex-start !important;
  flex: 0 0 auto !important; width: auto !important; max-width: none !important;
  height: 27px !important; min-height: 27px !important; padding: 0 !important;
  background: transparent !important; border: 0 !important; border-radius: 0 !important;
  color: #292829 !important; box-shadow: none !important;
  font-size: var(--shared-table-size, 12px) !important; line-height: 1.2 !important; font-weight: 600 !important;
}
.standard-table.standard-table thead th .standard-column-head button.standard-filter-button {
  width: 22px !important; min-width: 22px !important; flex-basis: 22px !important;
  justify-content: center !important; color: #8a8587 !important;
}
.standard-table.standard-table thead th .standard-column-head button.standard-filter-button.has-filter { color: #b3262d !important; }
.standard-sort-button { gap: 7px; }
.standard-sort-icon { display: block; flex: none; width: 16px; height: 16px; color: #8a8587; fill: currentColor; transform: rotate(0); transition: transform .16s; }
.standard-sort-icon.active { color: #b3262d; }
.standard-sort-icon.descending { transform: rotate(180deg); }
.standard-filter-button svg { display: block; flex: none; width: 16px; height: 16px; fill: currentColor; stroke: none; }
.standard-table.standard-table thead th .standard-column-head button:focus-visible { outline: 2px solid #356b53 !important; outline-offset: 2px; }
.standard-table-toolbar { display: flex; align-items: center; justify-content: flex-start; flex-wrap: nowrap; gap: 10px; max-width: 100%; overflow-x: auto; margin: 6px 0 2px; padding: 2px 1px 4px; color: #686668; white-space: nowrap; font-size: 11px; }
.standard-table-toolbar > * { flex-shrink: 0; }
.standard-table-toolbar button,.standard-filter-panel button,.standard-table-more button { font: inherit; font-weight: 400; background: var(--shared-button-bg,#fff); color: var(--shared-button-text,#424041); border: 1px solid var(--shared-button-border,#bdb9b2); border-radius: var(--shared-button-radius,4px); min-height: var(--shared-button-height,30px); padding: 5px 10px; }
.standard-table-toolbar button:disabled,.standard-filter-panel button:disabled { opacity: .5; cursor: default; }
.standard-table-count { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.standard-table-count output { display: block; min-width: 68px; padding: 7px 10px; background: #fff; border: 1px solid #bdb9b2; border-radius: 4px; color: #424041; text-align: right; }
.standard-table-more { display: flex; justify-content: center; max-width: 100%; padding: 8px 0; }
.standard-table-more[hidden] { display: none; }
.standard-filter-panel { position: fixed; z-index: 2147483000; display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box; padding: 10px; background: #fff; border: 1px solid #bdb9b2; border-radius: 5px; box-shadow: 0 5px 22px #42404126; color: #424041; font: 12px/1.4 var(--shared-font,Arial,sans-serif); }
.standard-filter-title,.standard-filter-sorts,.standard-filter-footer > div { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.standard-filter-title { flex-shrink: 0; margin-bottom: 6px; }
.standard-filter-title strong { font-size: 12px; font-weight: 500; }
.standard-filter-title button { min-height: 25px; padding: 1px 6px; font-size: 19px; line-height: 1; }
.standard-filter-sorts { flex-shrink: 0; margin-bottom: 6px; }
.standard-filter-sorts button { flex: 1; padding: 4px; font-size: 11px; }
.standard-clear-column { width: 100%; text-align: left; flex-shrink: 0; margin-bottom: 8px; }
body .standard-filter-panel button.standard-clear-column { text-align: left !important; }
.standard-filter-panel form { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.standard-filter-search { box-sizing: border-box; width: 100%; height: 32px; flex-shrink: 0; padding: 5px 7px; font: inherit; border: 1px solid #bdb9b2; border-radius: 3px; }
.standard-filter-all,.standard-filter-value { display: flex; align-items: flex-start; gap: 7px; min-height: 25px; padding: 4px 2px; cursor: pointer; color: #424041; font-size: 12px; line-height: 1.4; }
.standard-filter-all { flex-shrink: 0; margin: 4px 0; border-bottom: 1px solid #d9d6d0; }
.standard-filter-panel input[type=checkbox] { flex: none; width: 14px; height: 14px; min-height: 0; margin: 2px 0 0; accent-color: #424041; }
.standard-filter-values { flex: 1 1 160px; min-height: 32px; max-height: 210px; overflow: auto; overscroll-behavior: contain; }
.standard-filter-value span { flex: 1; overflow-wrap: anywhere; }
.standard-filter-value small { color: #686668; font-variant-numeric: tabular-nums; }
.standard-filter-value:hover { background: #f5f4f0; }
.standard-filter-footer { flex-shrink: 0; margin-top: 7px; padding-top: 7px; border-top: 1px solid #d9d6d0; }
.standard-filter-footer > small { display: block; margin-bottom: 6px; color: #686668; }
.standard-filter-footer > div { justify-content: flex-end; }
.standard-filter-range { display: flex; flex-shrink: 0; gap: 7px; margin: 0 0 8px; padding: 5px; border: 1px solid #d9d6d0; border-radius: 3px; }
.standard-filter-range legend { color: #686668; font-size: 11px; }
.standard-filter-range label { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.standard-filter-range input { box-sizing: border-box; width: 100%; min-width: 0; height: 29px; padding: 3px; font: inherit; border: 1px solid #bdb9b2; border-radius: 3px; }
.standard-filter-error { color: #963c34; margin: 0 0 7px; font-size: 11px; }
.standard-filter-error[hidden] { display: none; }
@media (prefers-reduced-motion:reduce) { .standard-sort-icon { transition: none; } }
@media (max-height:500px) { .standard-filter-panel { display: block; overflow: auto; } .standard-filter-panel form { overflow: visible; } .standard-filter-values { max-height: 80px; } .standard-filter-footer { position: sticky; bottom: -10px; background: #fff; } }

/* GRIMP menu tree: exclusive depth 1/2/3 and its two horizontal levels. */
.ksef-shell .unified-tree { min-height: 0; overflow: auto; flex: 1; padding-right: 2px; }
.ksef-shell .unified-expansion { display: flex; align-items: center; gap: 12px; padding: 2px 8px 8px; color: #596675; font-size: 11.5px; }
.ksef-shell .unified-expansion [role=radiogroup] { display: flex; align-items: center; gap: 12px; }
.ksef-shell .unified-expansion label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.ksef-shell .unified-expansion input { appearance: none; display: grid; place-items: center; width: 14px; height: 14px; margin: 0; border: 1px solid #89978e; border-radius: 2px; background: #fff; cursor: pointer; }
body #app .ksef-shell .unified-expansion input[data-menu-depth] { box-sizing: border-box; width: 14px; height: 14px; min-width: 14px; min-height: 14px; max-width: 14px; max-height: 14px; padding: 0; margin: 0; flex: 0 0 14px; }
.ksef-shell .unified-expansion input:checked { background: #356b53; border-color: #356b53; }
.ksef-shell .unified-expansion input:checked::after { content: "✓"; color: #fff; font-size: 11px; line-height: 1; }
.ksef-shell .unified-expansion input:focus-visible { outline: 2px solid #356b53; outline-offset: 2px; }
.ksef-shell .unified-tree ul { list-style: none; margin: 0; padding: 0; }
.ksef-shell .unified-tree li { margin: 2px 0; }
.ksef-shell .unified-tree button,.ksef-shell .unified-tree a { display: block; width: 100%; min-height: 30px; padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; color: #333d48; text-align: left; text-decoration: none; white-space: normal; transition: background-color .2s,color .2s; }
.ksef-shell .unified-tree .unified-area { min-height: 35px; background: #e7e4de; font-size: 13px; font-weight: 650; }
.ksef-shell .unified-tree .unified-area.active { background: #d5d2cb; color: #295c3c; }
.ksef-shell .unified-tree > ul > li:nth-child(-n+3) > .unified-area { background: #356b53; color: #fff; }
.ksef-shell .unified-tree > ul > li:nth-child(-n+3) > .unified-area:hover { background: #295c47; }
.ksef-shell .unified-tree > ul > li:nth-child(-n+3) > .unified-area .unified-chevron { color: #fff; }
.ksef-shell .unified-tree > ul > li:nth-child(3)::after { content: ""; display: block; margin: 12px 4px 16px; border-top: 1px solid #b9c8be; }
.ksef-shell .unified-tree .unified-area .ico { display: inline-block; width: 16px; height: 16px; margin-right: 10px; vertical-align: middle; }
.ksef-shell .unified-tree .unified-area > span:last-child { vertical-align: middle; }
.ksef-shell .unified-tree .unified-group { width: calc(100% - 13px); margin-left: 13px; font-size: 12px; }
.ksef-shell .unified-tree .unified-group.active { color: #295c3c; }
.ksef-shell .unified-tree .unified-group:hover,.ksef-shell .unified-tree .unified-tab:hover { background: #e8f1ed; }
.ksef-shell .unified-tree .unified-chevron { display: inline-block; width: 17px; color: #798291; }
.ksef-shell .unified-tree .unified-tab { width: calc(100% - 31px); min-height: 0; margin-left: 31px; padding: 6px 8px 6px 12px; border-left: 1px solid #cbd1c9; border-radius: 6px; color: #24518b; font-size: 11.5px; line-height: 1.3; }
.ksef-shell .unified-tree .unified-tab.active { background: #d7e8df; color: #356b53; border-left: 2px solid #356b53; font-weight: 650; }
.ksef-shell .unified-tree .unified-root-tab { width: calc(100% - 18px); margin-left: 18px; }
.ksef-shell .unified-branch { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .25s,opacity .2s; }
.ksef-shell .unified-branch.open { grid-template-rows: 1fr; opacity: 1; }
.ksef-shell .unified-branch > div { min-height: 0; overflow: hidden; }
.ksef-shell .ksef-horizontal { position: sticky; top: 53px; z-index: 19; margin: 0; padding: 8px 25px 10px; background: var(--bg); border-bottom: 1px solid #d8ded8; animation: ksef-menu-enter .22s both; }
.ksef-shell .unified-horizontal-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ksef-shell .ksef-horizontal:not(.unified-horizontal-row) > .unified-horizontal-row:first-child { border-bottom: 1px solid #e2e6e1; }
.ksef-shell .unified-horizontal-link { position: relative; display: inline-flex; align-items: center; min-height: 32px; padding: 6px 11px; border: 0; border-radius: 5px; background: transparent; color: #35566d; font-size: 12px; font-weight: 400; text-decoration: none; white-space: nowrap; box-shadow: none; transition: background-color .2s,color .2s; }
.ksef-shell .unified-horizontal-link:hover { background: #e8ece9; color: #244735; }
.ksef-shell .unified-horizontal-link.active { background: #e0e8e1; color: #295c3c; font-weight: 650; }
body #app .ksef-shell .unified-horizontal-link { background: transparent !important; color: #35566d !important; box-shadow: none !important; border: 0 !important; }
body #app .ksef-shell .unified-horizontal-link:hover { background: #e8ece9 !important; color: #244735 !important; }
body #app .ksef-shell .unified-horizontal-link.active { background: #e0e8e1 !important; color: #295c3c !important; box-shadow: none !important; }
body #app .ksef-shell .ksef-horizontal:not(.unified-horizontal-row) > .unified-horizontal-row:first-child > .unified-horizontal-link,
body #app .ksef-shell .ksef-horizontal:not(.unified-horizontal-row) > .unified-horizontal-row:first-child > .unified-horizontal-link.active { background: transparent !important; }
.ksef-shell .ksef-horizontal:not(.unified-horizontal-row) > .unified-horizontal-row:first-child > .unified-horizontal-link { border-radius: 0; background: transparent; color: #35566d; }
.ksef-shell .ksef-horizontal:not(.unified-horizontal-row) > .unified-horizontal-row:first-child > .unified-horizontal-link.active { color: #1f2933; }
.ksef-shell .ksef-horizontal:not(.unified-horizontal-row) > .unified-horizontal-row:first-child > .unified-horizontal-link.active::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: -1px; height: 2px; background: #e33333; }
.ksef-shell .unified-horizontal-children { margin-top: 0; padding-top: 4px; border-top: 0; animation: ksef-menu-enter .22s both; }
@keyframes ksef-menu-enter { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width:760px) {
 .ksef-shell .ksef-horizontal { top: 50px; padding: 6px 17px 8px; }
 .ksef-shell .unified-horizontal-row { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; }
}
@media (prefers-reduced-motion:reduce) {
 .ksef-shell .unified-tree button,.ksef-shell .unified-tree a,.ksef-shell .unified-branch,.ksef-shell .unified-horizontal-link { transition: none; }
 .ksef-shell .ksef-horizontal,.ksef-shell .unified-horizontal-children { animation: none; }
}
.ksef-shell .plan-level-nav{display:flex;align-items:center;gap:18px;min-height:49px;padding:7px 38px;background:#fff;border-bottom:1px solid #e5e1db;overflow-x:auto;scrollbar-width:thin}
.ksef-shell .plan-level-label{flex:none;color:#8a8587;font-size:10px;font-weight:700;letter-spacing:1px;text-transform:uppercase}
.ksef-shell .plan-level-list{display:flex;align-items:center;gap:5px;white-space:nowrap}
.ksef-shell .plan-level-list button{border:1px solid transparent;border-radius:7px;background:transparent;color:#514e4e;padding:8px 12px;font-size:12px;font-weight:600;white-space:nowrap}
.ksef-shell .plan-level-list button:hover,.ksef-shell .plan-level-list button:focus-visible{border-color:#d7e5dc;background:#edf4ef;color:#2d6548}
.plan-intro{color:#5d6870;line-height:1.6}
.plan-features{margin:18px 0 24px;padding-left:21px;line-height:1.8}
@media(max-width:760px){.ksef-shell .plan-level-nav{padding:7px 15px;gap:10px}.ksef-shell .plan-level-list button{padding:8px 9px;font-size:11px}}
.ksef-shell .plan-level-list button[aria-pressed="true"]{border-color:#b9d9c5;background:#eaf4ee;color:#245d40}
.ksef-shell.plan-free .unified-expansion,.ksef-shell.plan-free .sidebar-bottom p{display:none}
.free-editor .invoice-buyer-type,.free-editor .invoice-custom-fields,.free-editor .invoice-attachment-section,.free-editor .invoice-payment-flags,.free-editor .invoice-extra-fields,.free-editor .row-extra,.free-editor .discount-details{display:none}
.free-editor .buyer-fields label:nth-child(n+4){display:none}
.free-editor .invoice-line-table th:nth-child(7),.free-editor .invoice-line-table td:nth-child(7),.free-editor .invoice-line-table th:nth-child(8),.free-editor .invoice-line-table td:nth-child(8){display:none}
.free-editor .name-cell .button{display:block;margin-top:6px;font-size:10px;padding:5px 7px}

/* Bizness has a separate, menu-only navigation inspired by the inspected sidebar. */
.ksef-shell.business-shell{--sidebar-width:254px}
.ksef-shell.business-shell .sidebar{background:#fff;padding:20px 8px 16px}
.ksef-shell.business-shell .brand{margin:0 12px 18px}
.ksef-shell.business-shell .company{margin:0 12px 12px}
.ksef-shell.business-shell .business-tree{min-height:0;flex:1;overflow:auto;scrollbar-width:thin}
.ksef-shell.business-shell .business-tree ul{list-style:none;margin:0;padding:0}
.ksef-shell.business-shell .business-tree li{margin:0}
.ksef-shell.business-shell .business-tree button{display:flex;align-items:center;width:100%;min-height:39px;padding:8px 12px;border:0;border-radius:5px;background:transparent;color:#424041;text-align:left;font-size:12.5px;line-height:1.3;cursor:pointer}
.ksef-shell.business-shell .business-tree button:hover{background:#f4eef7;color:#6c2f81}
.ksef-shell.business-shell .business-tree button:focus-visible{outline:2px solid #7d3f9e;outline-offset:-2px}
.ksef-shell.business-shell .business-tree .business-root{gap:12px;font-weight:550}
.ksef-shell.business-shell .business-tree .business-root .ico{width:17px;height:17px;color:#6a6770}
.ksef-shell.business-shell .business-tree .business-root.active,.ksef-shell.business-shell .business-tree .business-root.expanded{background:#f4eef7;color:#662781}
.ksef-shell.business-shell .business-tree .business-root.active .ico,.ksef-shell.business-shell .business-tree .business-root.expanded .ico{color:#79339b}
.ksef-shell.business-shell .business-chevron{margin-left:auto;color:#8a858f;font-size:18px;line-height:1;transition:transform .16s}
.ksef-shell.business-shell .business-root[aria-expanded="true"] .business-chevron{transform:rotate(180deg)}
.ksef-shell.business-shell .business-children[hidden]{display:none}
.ksef-shell.business-shell .business-tree .business-child{min-height:35px;padding:7px 9px 7px 41px;font-size:12px;font-weight:400}
.ksef-shell.business-shell .business-tree .business-child.active{background:#f4eef7;color:#662781;font-weight:650;box-shadow:inset 3px 0 #8c3eaa}
.ksef-shell.business-shell .plan-level-list button[aria-pressed="true"]{border-color:#d8c1e4;background:#f5ebfa;color:#662781}
.ksef-shell.business-shell .business-placeholder{max-width:780px;line-height:1.6}
.ksef-shell.business-shell .business-placeholder p{margin-bottom:0;color:#686668}
@media(max-width:760px){.ksef-shell.business-shell{--sidebar-width:254px}}
@media(prefers-reduced-motion:reduce){.ksef-shell.business-shell .business-chevron{transition:none}}
