.invoice-page {max-width:1200px;margin:0 auto;display:grid;gap:20px;min-width:0}
.invoice-page h1,.invoice-page h2 {font-weight:700}
.invoice-page-header,.invoice-actions,.invoice-line-footer {display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.invoice-actions {justify-content:flex-start}
.invoice-page .btn-premium,.invoice-page .btn-secondary {padding:10px 16px;border-radius:12px}
.invoice-editor {display:grid;gap:18px;min-width:0}
.invoice-panel,.invoice-party {min-width:0;padding:18px;border:1px solid #343434;border-radius:16px;background:#191919}
.invoice-panel h2 {margin:16px 0 12px}
.invoice-fields-grid,.invoice-parties {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.invoice-party {display:grid;align-content:start;gap:12px}
.invoice-party legend,.invoice-line legend {padding:0 6px;font-weight:650}
.invoice-field {display:grid;gap:6px;min-width:0;color:#bdbdbd;font-size:13px}
.invoice-field input,.invoice-field textarea,.invoice-field select,.invoice-tax-fields select {width:100%;min-width:0;padding:10px 12px;border:1px solid #3a3a3a;border-radius:10px;color:#f4f4f4;background:#121212;font-size:14px}
.invoice-field input:focus,.invoice-field textarea:focus,.invoice-field select:focus {outline:2px solid #b5331b;outline-offset:1px}
.invoice-field input[type=number] {appearance:textfield}
.invoice-field textarea {resize:vertical}
.invoice-tax-fields {display:grid;grid-template-columns:minmax(220px,2fr) minmax(110px,1fr);gap:14px;max-width:650px}
.invoice-lines {display:grid;gap:16px;margin-bottom:16px}
.invoice-line {padding:14px;border:1px solid #373737;border-radius:12px;display:grid;gap:12px;min-width:0;background:#141414}
.invoice-line-fields {display:grid;grid-template-columns:1fr .7fr 1fr .7fr;gap:12px}
.invoice-remove {color:#d2a39b;font-size:13px;padding:8px}
.invoice-remove:disabled {opacity:.35}
.invoice-editor-totals {display:grid;grid-template-columns:auto max-content;gap:8px 22px;max-width:450px;margin:20px 0 0 auto;font-size:14px}
.invoice-editor-totals dd {text-align:right;font-variant-numeric:tabular-nums}
.invoice-editor-totals dt:nth-last-child(2),.invoice-editor-totals dd:last-child {border-top:1px solid #444;padding-top:10px;color:#f5f5f5;font-weight:750;font-size:19px}
.invoice-error {padding:12px;background:#6e241c;color:#fff;border-radius:10px}
.invoice-list {display:grid;gap:12px}
.invoice-list a {display:flex;justify-content:space-between;gap:14px;flex-wrap:wrap;padding:18px;background:#191919;border:1px solid #333;border-radius:14px}
.invoice-list a:hover {border-color:#b5331b}
.invoice-list strong {font-weight:700}
.invoice-list span {margin-left:14px;color:#999;font-size:13px}
.invoice-list p,.invoice-list-count {margin-top:4px;color:#aaa;font-size:14px}
.invoice-search {display:flex;align-items:end;gap:12px}
.invoice-search .invoice-field {flex:1}
.invoice-picker-results {display:grid;gap:10px;margin-top:12px;padding:14px;border:1px solid #444;border-radius:12px;background:#171717}
.invoice-picker-results ul {max-height:280px;overflow:auto}
.invoice-picker-results li button {width:100%;text-align:left;padding:10px;border-bottom:1px solid #333}
.invoice-picker-results li button:hover {background:#242424}
.invoice-preview-scroll {min-width:0;overflow-x:auto;border-radius:12px}
.invoice-print-help {color:#a3a3a3;font-size:13px}

.invoice-document {width:210mm;min-height:297mm;margin:0 auto;background:#fff;color:#111;padding:13mm 12mm;font:11px/1.3 Arial,sans-serif;overflow-wrap:anywhere}
.invoice-document p {margin:0}
.invoice-document strong {font-weight:bold}
.invoice-document h1 {font-weight:bold;font-size:17px;border-bottom:2px solid #333;margin:23px 0 12px;padding-bottom:4px}
.invoice-terms {text-align:center;font-size:10px;margin:0 6mm 17px!important}
.invoice-payment-title {font-weight:bold;text-align:center;font-size:12px;margin:16px 0 5px}
.invoice-payment-details {border:1px solid #444;padding:12px 16px}
.invoice-payment-details>p {margin-bottom:7px}
.invoice-payment-bank {display:grid;grid-template-columns:1fr 1.2fr;gap:20px}
.invoice-payment-bank p {display:grid;gap:5px}
.invoice-payment-bank strong {border-bottom:1px solid #666;padding-bottom:3px}
.invoice-counterparties {display:grid;grid-template-columns:90px minmax(0,1fr);gap:15px 10px;margin-bottom:13px}
.invoice-counterparties dd p {font-size:10px}
.invoice-document-items {width:100%;table-layout:fixed;border-collapse:collapse;font-size:10px}
.invoice-document-items th,.invoice-document-items td {border:1px solid #222;padding:4px;vertical-align:top;overflow-wrap:break-word;line-height:1.2}
.invoice-document-items th {font-weight:bold;text-align:center;background:#eee}
.invoice-document-items td {text-align:right;font-variant-numeric:tabular-nums}
.invoice-document-items td:nth-child(2) {text-align:left;white-space:pre-line}
.invoice-document-items td:first-child,.invoice-document-items td:nth-child(4) {text-align:center}
.invoice-document-items tfoot th,.invoice-document-items tfoot td {border:0;padding-top:7px;font-weight:bold;text-align:right;background:white}
.invoice-document-items tfoot tr:last-child td,.invoice-document-items tfoot tr:last-child th {padding-top:2px}
.invoice-words {margin:15px 0 10px;border-bottom:2px solid #444;padding-bottom:10px}
.invoice-words>strong {display:block;margin-top:5px}
.invoice-signature {text-align:right;margin:14px 0}
.invoice-signature span {display:inline-block;min-width:180px;margin-left:20px;border-bottom:1px solid #555}
.invoice-print-value {display:none}
@media(max-width:640px) {
  .invoice-parties,.invoice-fields-grid {grid-template-columns:1fr}
  .invoice-line-fields {grid-template-columns:repeat(2,minmax(0,1fr))}
  .invoice-tax-fields {grid-template-columns:1fr}
  .invoice-panel,.invoice-party {padding:13px}
  .invoice-search {flex-wrap:wrap}
  .invoice-document {width:100%;min-width:340px;min-height:0;padding:14px;font-size:10px}
  .invoice-document h1 {font-size:14px}
  .invoice-counterparties {grid-template-columns:65px minmax(0,1fr);gap:9px}
  .invoice-document-items {font-size:8px}
  .invoice-document-items td,.invoice-document-items th {padding:2px}
  .invoice-signature span {min-width:120px}
}
@page payment-invoice {size:A4;margin:12mm}
@media print {
  body:has(.invoice-document) *:not(.invoice-document):not(.invoice-document *):not(:has(.invoice-document)) {display:none!important}
  html:has(.invoice-document),body:has(.invoice-document),body *:has(.invoice-document) {padding:0!important;margin:0!important;min-height:0!important;height:auto!important;max-width:none!important;width:auto!important;overflow:visible!important;display:block!important;background:white!important}
  .invoice-document {page:payment-invoice;padding:0;width:100%;min-height:0;margin:0;color:#000;print-color-adjust:exact;-webkit-print-color-adjust:exact}
  .invoice-document-items thead {display:table-header-group}
  .invoice-document-items tfoot {display:table-row-group}
  .invoice-document-items tr,.invoice-payment-details,.invoice-signature,.invoice-words {break-inside:avoid}
  .invoice-screen-mask {display:none!important}
  .invoice-print-value {display:inline}
}
