.inv {
  --ink: #1d1b16;
  --muted: #5f5a4e;
  --accent: #1d1b16;
  --line: #cfc9b8;
  --head-bg: transparent;
  --head-ink: var(--ink);
  --th-bg: transparent;
  --th-ink: var(--ink);
  --grand-bg: transparent;
  --grand-ink: var(--ink);
  --font: Georgia, "Times New Roman", serif;
  container-type: inline-size;
  box-sizing: border-box;
  background: #fff;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  padding: 32px;
  overflow-wrap: anywhere;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.inv p { margin: 0; }
.inv dl, .inv dd { margin: 0; }
.inv-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 0 0 16px;
  margin-bottom: 24px;
  background: var(--head-bg);
  color: var(--head-ink);
  border-bottom: 2px solid var(--accent);
}
.inv-id { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.inv-logo { display: block; max-width: 160px; max-height: 72px; width: auto; height: auto; object-fit: contain; }
.inv-doc { font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.inv-meta { display: grid; gap: 4px; font-size: 13px; min-width: 0; }
.inv-meta div { display: flex; justify-content: space-between; gap: 16px; }
.inv-meta dt { opacity: 0.75; }
.inv-meta dd { font-weight: 600; text-align: right; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.inv-party { min-width: 0; }
.inv-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px !important; }
.inv-items { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.inv-items th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--th-bg);
  color: var(--th-ink);
  padding: 8px;
  border-bottom: 1px solid var(--accent);
}
.inv-items td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.inv-items th:not(:first-child), .inv-items td:not(:first-child) { text-align: right; white-space: nowrap; }
.inv-items th:first-child, .inv-items td:first-child { width: 50%; }
.inv-empty td { text-align: center !important; color: var(--muted); }
.inv .inv-totals { margin: 0 0 24px auto; width: min(100%, 280px); display: grid; gap: 4px; }
.inv-totals div { display: flex; justify-content: space-between; gap: 16px; padding: 4px 8px; }
.inv-totals dd { font-variant-numeric: tabular-nums; }
.inv-totals .inv-grand { font-size: 16px; font-weight: 700; background: var(--grand-bg); color: var(--grand-ink); border-top: 1px solid var(--accent); padding: 8px; }
.inv-notes { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink); font-size: 13px; }

@container (max-width: 479px) {
  .inv-parties { grid-template-columns: 1fr; gap: 16px; }
  .inv-items thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .inv-items, .inv-items tbody, .inv-items tr, .inv-items td { display: block; width: 100%; box-sizing: border-box; }
  .inv-items tr { border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; margin-bottom: 8px; }
  .inv-items td, .inv-items th:first-child, .inv-items td:first-child { width: auto; border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 16px; text-align: right; white-space: normal; }
  .inv-items td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; }
  .inv-items td:first-child { display: block; text-align: left; font-weight: 600; padding-bottom: 8px; }
  .inv-items td:first-child::before { display: none; }
  .inv .inv-totals { width: 100%; }
}

.t-modern {
  --accent: #14507a;
  --head-bg: #14507a;
  --head-ink: #fff;
  --th-bg: #e8f0f6;
  --th-ink: #14507a;
  --grand-bg: #e8f0f6;
  --grand-ink: #14507a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.t-modern .inv-head { padding: 20px; border-bottom: 0; border-radius: 6px; }
.t-modern .inv-meta dt { opacity: 0.85; }

.t-minimal {
  --accent: #1d1b16;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.t-minimal .inv-head { border-bottom: 1px solid var(--line); }
.t-minimal .inv-doc { font-size: 20px; font-weight: 400; letter-spacing: 0.18em; }
.t-minimal .inv-items th { border-bottom: 1px solid var(--line); font-weight: 500; }
.t-minimal .inv-totals .inv-grand { border-top: 1px solid var(--line); }

.t-gold {
  --accent: #b8892b;
  --muted: #6e5a2c;
  --line: #e3d6b0;
  --head-bg: #1c1a14;
  --head-ink: #f0d68a;
  --th-bg: #f6efd8;
  --th-ink: #4a3a10;
  --grand-bg: #1c1a14;
  --grand-ink: #f0d68a;
  --font: Georgia, "Times New Roman", serif;
}
.t-gold .inv-head { padding: 20px; border-bottom: 4px solid var(--accent); border-radius: 4px 4px 0 0; }
.t-gold .inv-doc { letter-spacing: 0.12em; }
.t-gold .inv-totals .inv-grand { border-top: 0; border-radius: 4px; }

@media screen and (max-width: 599px) {
  .inv { padding: 16px; }
}

@container (max-width: 479px) {
  .inv .inv-doc { font-size: 22px; letter-spacing: 0.04em; }
  .inv-head { gap: 12px; }
}
