/* Invoice preview — a Bulgarian ФАКТУРА laid out like the printed document.
   Scoped under .invoice / .invoice-body so it never affects other pages. */
.invoice-body {
  background: #f1f3f7;
  margin: 0;
  padding: 24px 12px 60px;
  font-family: Arial, Helvetica, sans-serif;
  color: #111;
}
.invoice-toolbar {
  max-width: 820px;
  margin: 0 auto 16px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.invoice {
  max-width: 820px;
  margin: 0 auto;
  background: #fff;
  padding: 40px 44px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  line-height: 1.45;
}

/* Logo header */
.invoice-logo { margin: 0 0 22px; }
.invoice-logo img { height: 46px; width: auto; }

/* Parties */
.invoice-parties { display: flex; gap: 24px; }
.invoice-party { flex: 1; min-width: 0; }
.invoice-party-label { font-weight: bold; font-size: 12px; letter-spacing: 0.04em; margin-bottom: 6px; }
.invoice-box { border: 1.5px solid #111; padding: 0; }
.invoice-box-name { font-weight: bold; padding: 10px 12px 2px; white-space: pre-line; }
.invoice-box-addr { padding: 0 12px 10px; white-space: pre-line; border-bottom: 1px solid #111; }
.invoice-box dl { margin: 0; }
.invoice-box dl > div { display: flex; border-bottom: 1px solid #111; }
.invoice-box dl > div:last-child { border-bottom: none; }
.invoice-box dt { width: 96px; flex-shrink: 0; padding: 6px 10px; border-right: 1px solid #111; }
.invoice-box dd { margin: 0; padding: 6px 10px; }

/* Title block */
.invoice-title-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1.5px solid #111;
  border-top: none;
  margin-top: -1px;
  padding: 18px 24px;
}
.invoice-stamp { font-size: 38px; font-weight: bold; }
.invoice-title-meta { text-align: right; }
.invoice-title-meta h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: 0.02em; }
.invoice-meta-row { font-size: 13px; }
.invoice-meta-row span { color: #333; }
.invoice-meta-row strong { display: inline-block; min-width: 96px; text-align: left; padding-left: 8px; background: #eee; }

/* Line items */
.invoice-items { width: 100%; border-collapse: collapse; margin: 22px 0 18px; }
.invoice-items th { background: #ededed; text-align: left; }
.invoice-items th, .invoice-items td { border: 1px solid #111; padding: 7px 10px; }
.invoice-items .num { width: 34px; text-align: center; }
.invoice-items .qty { text-align: right; white-space: nowrap; }

/* Lower area: bank + totals */
.invoice-lower { display: flex; gap: 24px; align-items: flex-start; }
.invoice-bank { border-collapse: collapse; flex: 0 0 48%; align-self: flex-start; }
.invoice-bank th, .invoice-bank td { border: 1px solid #999; padding: 6px 10px; text-align: left; font-weight: normal; }
.invoice-bank th { font-weight: normal; color: #333; }
.invoice-bank td:first-child { color: #333; width: 92px; }

.invoice-totals { flex: 1; border-collapse: collapse; }
.invoice-totals td { padding: 5px 0; vertical-align: top; }
.invoice-totals .lbl { text-align: right; color: #333; padding-right: 16px; }
.invoice-totals .val { text-align: right; white-space: nowrap; width: 130px; }
.invoice-totals .val strong { display: block; }
.invoice-totals .val span { display: block; font-size: 11px; color: #666; }
.invoice-total-due .lbl .rate { font-size: 10px; color: #888; }
.invoice-total-due .val strong { font-size: 18px; }
.invoice-total-due .val .big { font-size: 18px; color: #111; font-weight: bold; }

/* Notes */
.invoice-notes { margin: 26px 0 0; border-top: 1px solid #ccc; }
.invoice-notes > div { padding: 9px 2px; border-bottom: 1px solid #eee; }
.invoice-notes span { color: #444; }
.invoice-signatures { display: flex; justify-content: space-between; margin-top: 28px; }

@media print {
  /* Zero the page margin and inset the invoice via its own padding instead —
     this way the left/right (and top/bottom) space survives even if the print
     dialog's margins are set to "None". */
  @page { margin: 0; }
  .invoice-body { background: #fff; padding: 0; }
  .invoice-toolbar { display: none; }
  .invoice { box-shadow: none; max-width: none; padding: 16mm; }
}
