* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #222;
  background: #e9e9e9;
}

.page-wrap {
  min-height: 100vh;
  padding: 24px 20px;
}

.invoice-page {
  width: 100%;
  max-width: 794px;
  min-height: 1123px;
  margin: 0 auto;
  background: #fff;
  padding: 34px 34px 28px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.header-left {
  width: 65%;
}

.logo-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.logo {
  display: block;
  width: 250px;
  height: auto;
}

.paid {
  border: 2px solid #6cb46e;
  color: #5da35f;
  font-size: 22px;
  line-height: 1;
  padding: 5px 10px 7px;
  margin-top: 0;
}

.paid.status-paid {
  border-color: #4f9f59;
  color: #357d3f;
}

.paid.status-pending {
  border-color: #9a9a9a;
  color: #666;
}

.paid.status-overdue {
  border-color: #e29d49;
  color: #b46a12;
}

.paid.status-partially-paid {
  border-color: #5a8fd3;
  color: #2e63a8;
}

.paid.status-cancelled {
  border-color: #d46262;
  color: #af3535;
}

.company-text {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #555;
}

.company-text span {
  display: block;
}
.company-text .name{
  font-weight: bold;
}

.header-right {
  width: 35%;
  text-align: right;
}

.header-right h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 700;
  color: #333;
  white-space: nowrap;
}

.invoice-id {
  margin-top: 12px;
  font-size: 15px;
  font-weight: 700;
  color: #3b3b3b;
}

.balance-due-label {
  margin-top: 24px;
  font-size: 12px;
  font-weight: 700;
  color: #555;
}

.balance-due-value {
  margin-top: 3px;
  font-size: 25px;
  font-weight: 700;
  color: #222;
}

.meta-section {
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.bill-to {
  width: 44%;
}

.bill-label {
  font-size: 14px;
  color: #4e4e4e;
  margin-bottom: 4px;
}

.bill-name {
  font-size: 14px;
  font-weight: 700;
  color: #2f2f2f;
}

.meta-table {
  width: 54%;
  border-collapse: collapse;
}

.meta-table td {
  padding: 4px 0;
  font-size: 14px;
  line-height: 1.2;
}

.meta-table td:first-child {
  text-align: right;
  color: #525252;
  padding-right: 16px;
  white-space: nowrap;
}

.meta-table td:last-child {
  text-align: right;
  color: #3b3b3b;
}

.items-table {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
}

.items-table thead th {
  background: #3b3b3b;
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  padding: 9px 12px;
  border-right: 1px solid #4d4d4d;
  text-align: left;
}
.items-table thead th.right {
  text-align: right;
}

.items-table thead th:last-child {
  border-right: none;
}

.items-table tbody td {
  font-size: 12px;
  color: #383838;
  padding: 9px 12px;
  border-bottom: 1px solid #d6d6d6;
}

.cell-num {
  width: 48px;
  text-align: center;
}

.cell-qty,
.cell-rate,
.cell-amount {
  width: 140px;
  text-align: right;
  white-space: nowrap;
}

.cell-qty.payment,
.cell-rate.payment,
.cell-amount.payment {
  color: #d04444;
}

.totals-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.totals-table {
  width: 51%;
  border-collapse: collapse;
}

.totals-table td {
  font-size: 14px;
  color: #363636;
  padding: 6px 4px;
}

.totals-table td:first-child {
  text-align: right;
  padding-right: 20px;
}

.totals-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.totals-table .row-total td {
  font-weight: 700;
}

.totals-table .payment {
  color: #d04444;
}

.totals-table .row-balance td {
  background: #f1f1f1;
  font-weight: 700;
}

.notes {
  margin-top: 68px;
}

.notes-title {
  font-size: 16px;
  color: #4f4f4f;
}

.notes p {
  margin-top: 14px;
  font-size: 12px;
  color: #3e3e3e;
}

.footer-note {
  margin-top: 240px;
  padding-top: 7px;
  border-top: 1px solid #c6c6c6;
  font-size: 9px;
  color: #b6b6b6;
}

@page {
  size: A4;
  margin: 0;
}

@media print {
  .page-wrap {
    padding: 0;
  }

  .invoice-page {
    max-width: 100%;
  }
}

.payments-section {
  margin-top: 18px;
}

.payments-table {
  width: 60%;
  border-collapse: collapse;
}

.payments-table thead th {
  background: #3b3b3b;
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  padding: 9px 12px;
  border-right: 1px solid #4d4d4d;
  text-align: left;
}

.payments-table thead th.right {
  text-align: right;
}

.payments-table thead th:last-child {
  border-right: none;
}

.payments-table tbody td {
  font-size: 12px;
  color: #383838;
  padding: 9px 12px;
  border-bottom: 1px solid #d6d6d6;
}

.p-col-label {
  width: 220px;
  white-space: nowrap;
}

.p-col-amount {
  width: 170px;
  text-align: right;
  white-space: nowrap;
}

.p-col-status {
  width: 140px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.p-col-status.status-paid {
  color: #357d3f;
}

.p-col-status.status-pending {
  color: #666;
}

.p-col-status.status-overdue {
  color: #b46a12;
}

.p-col-status.status-partially-paid {
  color: #2e63a8;
}

.p-col-status.status-cancelled {
  color: #af3535;
}
