/* Invoice — A4 printable HTML (Save as PDF via browser print) */
:root {
  --inv-gold: #c4a35a;
  --inv-gold-dark: #9a7b2f;
  --inv-ink: #141210;
  --inv-muted: #8a8378;
  --inv-border: #ebe4d8;
  --inv-soft: #f7f2e8;
  --inv-ui: "Figtree", "Segoe UI", sans-serif;
  --inv-serif: var(--inv-ui);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #ece7de;
  color: var(--inv-ink);
  font-family: var(--inv-ui);
  font-size: 12px;
  line-height: 1.45;
}

.inv-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--inv-border);
  backdrop-filter: blur(8px);
}

.inv-toolbar button,
.inv-toolbar a {
  display: inline-flex;
  align-items: center;
  min-height: 2.3rem;
  padding: 0 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--inv-border);
  background: #fff;
  color: var(--inv-ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.inv-toolbar .is-primary {
  border: 0;
  background: linear-gradient(180deg, #d4b56a 0%, var(--inv-gold-dark) 100%);
  color: #fff;
}

.inv-sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 1.25rem auto 2rem;
  padding: 16mm 15mm 14mm;
  background: #fff;
  box-shadow: 0 10px 40px rgba(20, 18, 16, 0.12);
}

.inv-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.4rem;
}

.inv-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 0;
}

.inv-logo {
  display: block;
  width: 168px;
  height: auto;
}

.inv-brand strong {
  display: block;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inv-brand span {
  display: block;
  color: var(--inv-muted);
  font-size: 11px;
}

.inv-company {
  text-align: right;
  color: var(--inv-muted);
  font-size: 11px;
  max-width: 280px;
}

.inv-company strong {
  display: block;
  color: var(--inv-ink);
  font-size: 12px;
  margin-bottom: 0.2rem;
}

.inv-intro h1 {
  margin: 0;
  font-family: var(--inv-serif);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
}

.inv-intro p {
  margin: 0.35rem 0 0;
  color: var(--inv-muted);
  font-size: 12px;
}

.inv-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.1rem 0 1.35rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--inv-border);
  border-bottom: 1px solid var(--inv-border);
}

.inv-meta span {
  display: block;
  color: var(--inv-muted);
  font-size: 10px;
  margin-bottom: 0.2rem;
}

.inv-meta strong {
  display: block;
  font-size: 12px;
}

.inv-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
}

.inv-badge.is-paid,
.inv-badge.is-completed,
.inv-badge.is-delivered {
  background: #e8f8ef;
  color: #027a48;
}

.inv-badge.is-preparing,
.inv-badge.is-processing,
.inv-badge.is-shipped {
  background: #fff4e5;
  color: #b54708;
}

.inv-badge.is-cancelled {
  background: #fdecea;
  color: #d92d20;
}

.inv-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.35rem;
}

.inv-parties h2 {
  margin: 0 0 0.45rem;
  font-family: var(--inv-serif);
  font-size: 16px;
  font-weight: 600;
}

.inv-parties strong {
  display: block;
  font-size: 12.5px;
  margin-bottom: 0.25rem;
}

.inv-parties p {
  margin: 0;
  color: #4a453e;
  white-space: pre-line;
  font-size: 11.5px;
}

.inv-parties small {
  display: block;
  margin-top: 0.35rem;
  color: var(--inv-muted);
  font-size: 11px;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.85rem;
}

.inv-table th {
  background: var(--inv-soft);
  color: #5c564e;
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--inv-border);
}

.inv-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid #f1ece3;
  vertical-align: top;
  font-size: 11.5px;
}

.inv-table th:nth-child(1),
.inv-table td:nth-child(1) { width: 28px; color: var(--inv-muted); }

.inv-table th:nth-child(4),
.inv-table td:nth-child(4),
.inv-table th:nth-child(5),
.inv-table td:nth-child(5),
.inv-table th:nth-child(6),
.inv-table td:nth-child(6) {
  text-align: right;
  white-space: nowrap;
}

.inv-product {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
}

.inv-thumb {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #faf6ee;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.inv-thumb svg { width: 18px; height: 24px; }
.inv-thumb.is-coin svg { width: 22px; height: 22px; }

.inv-product strong {
  display: block;
  font-size: 12px;
}

.inv-product em {
  display: block;
  margin-top: 0.1rem;
  font-style: normal;
  color: var(--inv-muted);
  font-size: 10.5px;
}

.inv-specs {
  color: var(--inv-muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.inv-totals {
  width: 260px;
  margin-left: auto;
  margin-bottom: 1.25rem;
}

.inv-totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  font-size: 12px;
}

.inv-totals dt { color: var(--inv-muted); }
.inv-totals dd { margin: 0; font-weight: 600; }

.inv-totals .is-total {
  margin-top: 0.25rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: #f8f0df;
}

.inv-totals .is-total dt {
  color: var(--inv-ink);
  font-weight: 700;
}

.inv-totals .is-total dd {
  font-family: var(--inv-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--inv-gold-dark);
}

.inv-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.inv-box {
  border: 1px solid var(--inv-border);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
}

.inv-box h3 {
  margin: 0 0 0.55rem;
  font-size: 12.5px;
  font-weight: 700;
}

.inv-box dl {
  margin: 0;
}

.inv-box div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-top: 1px solid #f1ece3;
}

.inv-box div:first-of-type { border-top: 0; padding-top: 0; }

.inv-box dt {
  color: var(--inv-muted);
  font-size: 10.5px;
}

.inv-box dd {
  margin: 0;
  text-align: right;
  font-size: 11.5px;
  font-weight: 600;
}

.inv-notes {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  background: #f6f4f0;
  margin-bottom: 1.15rem;
}

.inv-notes svg {
  flex: 0 0 auto;
  color: var(--inv-gold-dark);
  margin-top: 0.1rem;
}

.inv-notes strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 12px;
}

.inv-notes ul {
  margin: 0;
  padding-left: 1.1rem;
  color: #5c564e;
  font-size: 10.5px;
}

.inv-notes li + li { margin-top: 0.2rem; }

.inv-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--inv-border);
  color: var(--inv-muted);
  font-size: 10.5px;
}

.inv-footer strong {
  display: block;
  color: var(--inv-ink);
  font-size: 11.5px;
  margin-bottom: 0.15rem;
}

.inv-footer a {
  color: inherit;
  text-decoration: none;
}

@media screen and (max-width: 860px) {
  .inv-sheet {
    width: auto;
    margin: 0.75rem;
    padding: 1.1rem;
  }

  .inv-header,
  .inv-parties,
  .inv-boxes,
  .inv-meta {
    grid-template-columns: 1fr;
    display: grid;
  }

  .inv-header { display: flex; flex-direction: column; }
  .inv-company { text-align: left; max-width: none; }
  .inv-meta { grid-template-columns: 1fr 1fr; }
  .inv-totals { width: 100%; }
}

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  html, body {
    background: #fff;
  }

  .inv-toolbar {
    display: none !important;
  }

  .inv-sheet {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  .inv-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
  }

  .inv-company {
    text-align: right !important;
    max-width: 240px !important;
  }

  .inv-meta {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }

  .inv-meta span {
    white-space: nowrap;
  }

  .inv-parties,
  .inv-boxes {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }

  .inv-logo,
  .inv-badge,
  .inv-totals .is-total,
  .inv-table th,
  .inv-notes {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
