/* Online invoice tool. The sheet mirrors the app's printed invoice (public/invoice.css in the app), scoped to
   .inv-sheet so it keeps the same light look in the site's dark theme. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.invoice-layout {
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}

.invoice-form {
  display: grid;
  gap: 16px;
}

.invoice-form fieldset {
  min-width: 0;
  margin: 0;
}

.invoice-preview-column {
  position: sticky;
  top: calc(var(--header-h) + 16px);
}

.invoice-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.invoice-preview-column > .field-hint {
  margin: 8px 0 14px;
}

.invoice-preview {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #eef0f4;
  padding: 12px;
}

.item-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 110px 84px 40px;
  gap: 8px;
  align-items: end;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.item-row.no-vat {
  grid-template-columns: minmax(0, 1fr) 84px 110px 40px;
}

.item-row .field label {
  font-size: 12.5px;
  color: var(--text-muted);
}

.item-row .field input,
.item-row .field select {
  min-height: 42px;
  padding: 8px 10px;
  font-size: 15px;
}

.item-remove {
  display: grid;
  place-items: center;
  width: 40px;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.item-remove:hover {
  color: var(--warning);
  border-color: var(--warning);
}

.item-remove:disabled {
  opacity: 0.4;
  cursor: default;
}

.item-remove .icon {
  width: 18px;
  height: 18px;
}

/* The sheet is laid out at A4 size and scaled down to the column width with zoom (set in tool.js). */
.inv-sheet {
  --ink: #202534;
  position: relative;
  width: 210mm;
  min-height: 297mm;
  padding: 18mm 19mm 30mm;
  background: #fff;
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: normal;
  box-shadow: 0 12px 50px #1c28411c;
  color-scheme: light;
}

.inv-sheet * {
  box-sizing: border-box;
}

.inv-sheet h1,
.inv-sheet h2 {
  letter-spacing: normal;
  text-wrap: wrap;
}

.inv-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 24px;
  border-bottom: 1px solid #e8eaf0;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.4px;
}

.inv-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 28px 0 26px;
}

.inv-title-row h1 {
  margin: 0 0 9px;
  font-size: 26px;
  letter-spacing: -0.9px;
  line-height: 1.15;
  text-transform: uppercase;
}

.inv-number {
  color: #6d7380;
  font-size: 11px;
}

.inv-number b {
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.03em;
}

.inv-dates {
  display: flex;
  gap: 18px;
  color: #828896;
  font-size: 10px;
  line-height: 1.7;
}

.inv-dates div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.inv-dates strong {
  color: var(--ink);
  font-size: 12px;
}

.inv-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  padding: 18px 20px;
  border: 1px solid #edf0f4;
  border-radius: 8px;
  background: #f7f8fb;
}

.inv-label {
  margin: 0 0 10px;
  color: #858b98;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.inv-party-name {
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.inv-detail {
  display: flex;
  gap: 12px;
  margin: 4px 0;
  font-size: 9px;
  line-height: 1.4;
}

.inv-detail span {
  min-width: 94px;
  color: #898f9b;
}

.inv-detail b {
  color: #444b58;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.inv-placeholder {
  color: #b3b8c2;
  font-style: italic;
  font-weight: 500;
}

.inv-items {
  width: 100%;
  margin-top: 30px;
  border: 1px solid #e8eaf0;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 9px;
  overflow: hidden;
}

.inv-items thead {
  background: #f4f5f8;
}

.inv-items th {
  padding: 10px 8px;
  color: #767d8a;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
}

.inv-items td {
  padding: 13px 8px;
  border-bottom: 1px solid #eceef2;
  font-size: 10px;
  line-height: 1.45;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.inv-items tbody tr:last-child td {
  border-bottom: 0;
}

.inv-items td strong {
  font-weight: 600;
}

.inv-items .index {
  width: 32px;
  color: #9ba0aa;
}

.inv-items .align-right,
.inv-items th.align-right {
  text-align: right;
  white-space: nowrap;
}

.inv-items .strong {
  font-weight: 700;
}

.inv-lower {
  display: flex;
  justify-content: space-between;
  gap: 25px;
  margin-top: 24px;
}

.inv-payment {
  flex: 1;
  align-self: flex-end;
  min-width: 0;
  padding-bottom: 4px;
  overflow-wrap: anywhere;
}

.inv-payment h2,
.inv-notes h2 {
  margin: 0 0 8px;
  color: #656c7a;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inv-payment p {
  margin: 4px 0;
  color: #3f4654;
  font-size: 11px;
  line-height: 1.55;
}

.inv-totals {
  flex: none;
  width: 235px;
}

.inv-total-row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 6px 0;
  color: #727886;
  font-size: 10px;
}

.inv-total-row b {
  color: #303644;
  font-weight: 600;
  white-space: nowrap;
}

.inv-grand {
  margin-top: 8px;
  padding: 13px 14px;
  border-radius: 7px;
  background: #f0f3ff;
  color: #273a96;
  font-size: 11px;
  font-weight: 700;
}

.inv-grand b {
  color: #2449dc;
  font-size: 16px;
}

.inv-words {
  margin-top: 8px;
  padding: 0 2px;
  color: #303644;
  font-size: 9px;
  line-height: 1.45;
}

.inv-words span {
  display: block;
  margin-bottom: 2px;
  color: #9297a2;
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.inv-notes {
  margin-top: 25px;
  padding-top: 14px;
  border-top: 1px solid #eceef2;
}

.inv-notes div {
  color: #5e6470;
  font-size: 9px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.inv-footer {
  position: absolute;
  left: 19mm;
  right: 19mm;
  bottom: 10mm;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding-top: 8px;
  border-top: 1px solid #e8eaf0;
  color: #959aa5;
  font-size: 8px;
}

.inv-footer span {
  overflow-wrap: anywhere;
}

.inv-footer a {
  color: #858b98;
  font-size: 7px;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 1024px) {
  /* minmax(0, …): a plain 1fr track would grow to the A4 sheet's width instead of letting zoom shrink it. */
  .invoice-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .invoice-preview-column {
    position: static;
  }
}

@media (max-width: 640px) {
  .item-row,
  .item-row.no-vat {
    grid-template-columns: 1fr 1fr;
  }

  .item-row .item-description {
    grid-column: 1 / -1;
  }

  .item-remove {
    width: 100%;
  }
}

/* Printing leaves only the sheet, at full A4 size. */
@page {
  size: A4;
  margin: 0;
}

@media print {
  html,
  body {
    background: #fff !important;
  }

  .site-header,
  .site-footer,
  .skip-link,
  .cookie-banner,
  .no-print {
    display: none !important;
  }

  .tool-section {
    padding: 0;
  }

  .tool-section > .container {
    display: block;
    max-width: none;
    padding: 0;
  }

  .invoice-preview-column {
    position: static;
  }

  .invoice-preview {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    overflow: visible;
  }

  .inv-sheet {
    zoom: 1 !important;
    min-height: 297mm;
    box-shadow: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .inv-items thead {
    display: table-header-group;
  }

  .inv-items tr {
    break-inside: avoid;
  }
}
