/* ==========================================================================
   CREOSBILL 500-TEMPLATE STRUCTURAL ENGINE (250 INVOICE + 250 KWITANSI)
   Each template varies macro body layout (sidebars, KPI top, ledger), header,
   meta arrangement, table geometry, summary style, surface/frame & receipt.
   ========================================================================== */

/* Smooth 60fps virtualized painting for 250 live cards */
#cards .card,
#drawerGrid .drawer-card {
  content-visibility: auto;
  contain-intrinsic-size: 220px 340px;
}

/* Dense 25-Category Filter Chip Strip */
#filters,
#drawerFilters {
  gap: 7px;
}
#filters .filter,
#drawerFilters .filter {
  padding: 7px 12px;
  font-size: 12px;
}

/* ============ 1. FRAMES & PAPER SURFACES (frame-0 .. frame-9) ============ */
.invoice.frame-0 {
  --surface: #ffffff;
}
.invoice.frame-1 {
  border-top: 1.8cqw solid var(--accent);
  border-bottom: 1.8cqw solid var(--accent);
}
.invoice.frame-2 {
  --surface: #fafbfd;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--accent) 45%, transparent) 3cqw, transparent 3cqw),
    linear-gradient(to left, color-mix(in srgb, var(--accent) 45%, transparent) 3cqw, transparent 3cqw);
  background-size: 100% 0.28cqw;
  background-position: top center, bottom center;
  background-repeat: no-repeat;
  outline: 0.16cqw solid color-mix(in srgb, var(--accent) 32%, transparent);
  outline-offset: -2.6cqw;
}
.invoice.frame-3 {
  /* Cinema Filmstrip Perforation Strip */
  border-top: 2.2cqw dashed var(--ink);
  border-bottom: 2.2cqw dashed var(--ink);
  padding-block: 6.2cqw;
}
.invoice.frame-4 {
  /* Ticket Stub Perforated Cutout Style */
  --surface: #fffef9;
  border: 0.3cqw dashed color-mix(in srgb, var(--accent) 55%, var(--ink));
}
.invoice.frame-5 {
  --surface: #fcfaf4;
  border: 1cqw double var(--accent);
  padding: 8cqw;
}
.invoice.frame-6 {
  border-left: 2.8cqw solid var(--accent);
}
.invoice.frame-7 {
  background-image:
    radial-gradient(circle at 96% 4%, color-mix(in srgb, var(--accent) 16%, transparent) 0 18cqw, transparent 18.2cqw),
    radial-gradient(circle at 4% 96%, color-mix(in srgb, var(--accent) 12%, transparent) 0 15cqw, transparent 15.2cqw);
}
.invoice.frame-8 {
  --surface: #fbf6eb;
  --ink: #292218;
  --muted: #6c6152;
}
.invoice.frame-9 {
  --surface: #12151f;
  --ink: #eef2f7;
  --muted: #98a2b3;
  border: 0.25cqw solid color-mix(in srgb, var(--accent) 42%, transparent);
}
.invoice.frame-9 th {
  background: color-mix(in srgb, var(--accent) 26%, #181d2b);
  color: var(--accent);
  border-bottom: 0.3cqw solid var(--accent);
}
.invoice.frame-9 .total {
  background: color-mix(in srgb, var(--accent) 24%, #181d2b);
  color: #ffffff;
  border: 0.22cqw solid var(--accent);
}
.invoice.frame-9 td {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}
.invoice.frame-9 .receipt-box {
  background: rgba(255, 255, 255, 0.04);
  border-color: color-mix(in srgb, var(--accent) 36%, transparent);
}
.invoice.frame-9 .receipt-amount-pill {
  background: color-mix(in srgb, var(--accent) 26%, #181d2b);
  color: var(--accent);
  border: 0.22cqw solid var(--accent);
}

/* ============ 2. 10 HEADER ARCHITECTURES (hdr-0 .. hdr-9) ============ */
.invoice.hdr-0 .head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 0.22cqw solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding-bottom: 2.5cqw;
  margin-bottom: 3.5cqw;
}
.invoice.hdr-1 .head {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 0.4cqw solid var(--accent);
  padding-bottom: 2.5cqw;
  margin-bottom: 3.5cqw;
}
.invoice.hdr-1 .doc { text-align: left; }
.invoice.hdr-1 .identity { text-align: right; }

.invoice.hdr-2 .head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.6cqw;
  border-bottom: 0.22cqw solid color-mix(in srgb, var(--ink) 16%, transparent);
  padding-bottom: 2.8cqw;
  margin-bottom: 3.5cqw;
}
.invoice.hdr-2 .identity,
.invoice.hdr-2 .doc { max-width: 100%; text-align: center; }
.invoice.hdr-2 .logo { margin-inline: auto; }

.invoice.hdr-3 .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--accent);
  color: #ffffff;
  margin: -7cqw -7cqw 3.8cqw;
  padding: 5.2cqw 7cqw;
}
.invoice.hdr-3 .head h1,
.invoice.hdr-3 .head h2,
.invoice.hdr-3 .head p {
  color: #ffffff;
}
.invoice.frame-9.hdr-3 .head {
  background: color-mix(in srgb, var(--accent) 26%, #181d2b);
  border-bottom: 0.35cqw solid var(--accent);
}
.invoice.frame-9.hdr-3 .head h1 { color: var(--accent); }

.invoice.hdr-4 .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 1.1cqw solid var(--accent);
  padding-left: 2.6cqw;
  margin-bottom: 3.5cqw;
}

.invoice.hdr-5 .head {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 2.2cqw;
  margin-bottom: 3.2cqw;
}
.invoice.hdr-5 .identity,
.invoice.hdr-5 .doc {
  max-width: none;
  padding: 2.2cqw;
  border-radius: 1.4cqw;
  border: 0.18cqw solid color-mix(in srgb, var(--accent) 32%, transparent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.invoice.hdr-6 .head {
  display: flex;
  flex-direction: column-reverse;
  gap: 2.2cqw;
  margin-bottom: 3.5cqw;
}
.invoice.hdr-6 .doc {
  text-align: left;
  border-bottom: 0.45cqw solid var(--accent);
  padding-bottom: 1.2cqw;
}
.invoice.hdr-6 .doc h1 {
  font-size: 7.4cqw;
  letter-spacing: -0.05em;
}
.invoice.hdr-6 .identity {
  max-width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2cqw;
}

.invoice.hdr-7 .head {
  border-top: 0.35cqw dashed color-mix(in srgb, var(--ink) 35%, transparent);
  border-bottom: 0.35cqw dashed color-mix(in srgb, var(--ink) 35%, transparent);
  padding: 2.2cqw 0;
  margin-bottom: 3.2cqw;
  align-items: center;
}
.invoice.hdr-7 .doc p {
  font-family: "Courier New", monospace;
  font-weight: 700;
  padding: 0.4cqw 1cqw;
  border: 0.18cqw solid var(--accent);
  display: inline-block;
  margin-top: 0.4cqw;
}

.invoice.hdr-8 .head {
  border-top: 0.5cqw solid var(--ink);
  border-bottom: 0.5cqw double var(--ink);
  padding: 2cqw 0;
  margin-bottom: 3.2cqw;
}
.invoice.hdr-8 .doc h1 {
  color: var(--ink);
  font-size: 5.8cqw;
}

.invoice.hdr-9 .head {
  align-items: center;
  padding: 2.4cqw 2.8cqw;
  border-radius: 1.6cqw;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  margin-bottom: 3.2cqw;
}
.invoice.hdr-9 .doc h1 {
  font-size: 5.2cqw;
}

/* ============ 3. 6 MACRO BODY ARCHITECTURES (body-0 .. body-5) ============ */
.doc-layout-cols {
  display: grid;
  gap: 3cqw;
  align-items: start;
  flex: 1;
}
.body-1 .doc-layout-cols {
  grid-template-columns: 30% 1fr;
}
.body-2 .doc-layout-cols {
  grid-template-columns: 1fr 30%;
}
.doc-side-col {
  display: grid;
  gap: 2.2cqw;
  padding: 2cqw;
  border-radius: 1.5cqw;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 0.16cqw solid color-mix(in srgb, var(--accent) 26%, transparent);
}
.doc-side-col h3 {
  font-size: 1.45cqw;
  margin-bottom: 0.5cqw;
}
.doc-side-col b {
  display: block;
  font-size: 2cqw;
  margin-bottom: 0.4cqw;
}
.doc-side-col p {
  font-size: 1.65cqw;
  line-height: 1.48;
}
.doc-main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.doc-main-col th,
.doc-main-col td {
  font-size: 1.48cqw;
  padding: 1.15cqw 0.75cqw;
}
.doc-main-col th:nth-last-child(-n+3),
.doc-main-col td:nth-last-child(-n+3) {
  white-space: nowrap;
}

/* Body 3: Top KPI Strip */
.doc-kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.6cqw;
  margin-bottom: 3cqw;
}
.doc-kpi-card {
  padding: 1.6cqw 1.8cqw;
  border-radius: 1.3cqw;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border: 0.16cqw solid color-mix(in srgb, var(--accent) 24%, transparent);
}
.doc-kpi-card.is-accent {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.invoice.frame-9 .doc-kpi-card.is-accent {
  background: color-mix(in srgb, var(--accent) 25%, #181d2b);
  color: var(--accent);
}
.doc-kpi-card small {
  display: block;
  font-size: 1.3cqw;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.78;
}
.doc-kpi-card strong {
  display: block;
  margin-top: 0.4cqw;
  font-size: 2.15cqw;
  font-weight: 800;
}

/* Body 4: Framed Inner Sheet */
.body-4 .doc-inner-sheet {
  border: 0.2cqw solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-top: 0.55cqw solid var(--accent);
  border-radius: 1.2cqw;
  padding: 2.4cqw;
  background: color-mix(in srgb, var(--surface) 92%, var(--accent) 2%);
}

/* Body 5: Hero Total Callout Banner */
.doc-hero-callout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2cqw;
  padding: 2cqw 2.4cqw;
  border-radius: 1.4cqw;
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  border-left: 0.7cqw solid var(--accent);
  margin-bottom: 2.8cqw;
}
.doc-hero-callout__amt {
  text-align: right;
}
.doc-hero-callout__amt small {
  display: block;
  font-size: 1.35cqw;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.doc-hero-callout__amt strong {
  font-size: 3.1cqw;
  color: var(--accent);
  font-weight: 900;
}

/* ============ 4. 5 META ARRANGEMENTS (meta-0 .. meta-4) ============ */
.invoice.meta-1 .meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2cqw;
}
.invoice.meta-1 .meta > div:last-child { text-align: right; }

.invoice.meta-2 .meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2cqw;
}
.invoice.meta-2 .meta > div {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border: 0.15cqw solid color-mix(in srgb, var(--accent) 22%, transparent);
  padding: 1.8cqw;
  border-radius: 1.3cqw;
}
.invoice.meta-2 .meta > div:last-child { text-align: right; }

.invoice.meta-3 .meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 0.16cqw solid color-mix(in srgb, var(--ink) 18%, transparent);
  margin-bottom: 3cqw;
}
.invoice.meta-3 .meta > div {
  padding: 1.5cqw 1.8cqw;
  border-right: 0.15cqw solid color-mix(in srgb, var(--ink) 14%, transparent);
}
.invoice.meta-3 .meta > div:last-child { border-right: 0; text-align: left; }

.invoice.meta-4 .meta {
  flex-direction: column;
  gap: 1.6cqw;
  border-left: 0.5cqw solid var(--accent);
  padding-left: 2cqw;
}
.invoice.meta-4 .meta > div:last-child { text-align: left; }

/* ============ 5. 8 TABLE STRUCTURES (tbl-0 .. tbl-7) ============ */
.invoice.tbl-1 table {
  border: 0.18cqw solid color-mix(in srgb, var(--ink) 26%, transparent);
}
.invoice.tbl-1 th,
.invoice.tbl-1 td {
  border: 0.14cqw solid color-mix(in srgb, var(--ink) 18%, transparent);
}
.invoice.tbl-1 th:first-child,
.invoice.tbl-1 td:first-child {
  width: 8%;
  text-align: center;
}
.invoice.tbl-1 th:nth-child(2),
.invoice.tbl-1 td:nth-child(2) {
  width: 38%;
  text-align: left;
}
.invoice.tbl-1 th:nth-child(3),
.invoice.tbl-1 td:nth-child(3) {
  width: 10%;
}

.invoice.tbl-2 table {
  border-collapse: separate;
  border-spacing: 0 0.85cqw;
}
.invoice.tbl-2 th {
  background: transparent;
  color: var(--accent);
  border-bottom: 0.22cqw solid var(--accent);
}
.invoice.tbl-2 td {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-bottom: 0;
}
.invoice.tbl-2 td:first-child { border-radius: 0.9cqw 0 0 0.9cqw; }
.invoice.tbl-2 td:last-child { border-radius: 0 0.9cqw 0.9cqw 0; }

.invoice.tbl-3 tr:nth-child(even) td {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.invoice.tbl-3 th {
  background: var(--ink);
  color: var(--surface);
}

.invoice.tbl-4 table {
  font-family: "Courier New", monospace;
}
.invoice.tbl-4 th {
  background: transparent;
  color: var(--ink);
  border-top: 0.25cqw dashed var(--accent);
  border-bottom: 0.25cqw dashed var(--accent);
}
.invoice.tbl-4 td {
  border-bottom: 0.15cqw dashed color-mix(in srgb, var(--ink) 22%, transparent);
}

.invoice.tbl-5 th {
  background: transparent;
  color: var(--accent);
  border-top: 0.3cqw double var(--accent);
  border-bottom: 0.3cqw double var(--accent);
}

.invoice.tbl-6 th:last-child,
.invoice.tbl-6 td:last-child {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-weight: 700;
}

.invoice.tbl-7 td + td,
.invoice.tbl-7 th + th {
  border-left: 0.14cqw solid color-mix(in srgb, var(--ink) 14%, transparent);
}

/* ============ 6. 5 TOTAL SUMMARY PRESENTATIONS (sum-0 .. sum-4) ============ */
.invoice.sum-1 .summary-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2.4cqw;
  align-items: center;
  margin-bottom: 3.5cqw;
}
.invoice.sum-1 .summary {
  width: 100%;
  margin-bottom: 0;
}
.sum-kpi-box {
  padding: 2cqw 2.6cqw;
  border-radius: 1.4cqw;
  background: var(--accent);
  color: #ffffff;
  text-align: right;
  min-width: 28cqw;
}
.invoice.frame-9 .sum-kpi-box {
  background: color-mix(in srgb, var(--accent) 26%, #181d2b);
  border: 0.22cqw solid var(--accent);
  color: var(--accent);
}
.sum-kpi-box small {
  display: block;
  font-size: 1.35cqw;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
}
.sum-kpi-box strong {
  display: block;
  font-size: 2.9cqw;
  font-weight: 900;
  margin-top: 0.3cqw;
}

.invoice.sum-2 .summary {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.5cqw 3cqw;
  padding: 1.8cqw 2.2cqw;
  border-radius: 1.2cqw;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 0.16cqw solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.invoice.sum-2 .sumline { gap: 1.4cqw; }
.invoice.sum-2 .total { margin-top: 0; border-radius: 0.8cqw; padding: 0.9cqw 1.6cqw; }

.invoice.sum-3 .summary {
  align-self: flex-start;
  width: 58%;
  border-left: 0.6cqw solid var(--accent);
  padding-left: 2cqw;
}
.invoice.sum-3 .total {
  background: transparent;
  color: var(--accent);
  border: 0.24cqw solid var(--accent);
  border-radius: 0.9cqw;
}

.sum-terbilang-strip {
  margin-top: 1.6cqw;
  margin-bottom: 2.8cqw;
  padding: 1.2cqw 1.6cqw;
  border-left: 0.45cqw solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-style: italic;
  font-size: 1.75cqw;
}

/* ============ 7. 6 KWITANSI LAYOUT VARIATIONS (rcpt-0 .. rcpt-5) ============ */
.invoice.rcpt-1 .receipt-grid-split {
  display: grid;
  grid-template-columns: 36% 1fr;
  gap: 2.2cqw;
  margin-bottom: 3cqw;
}
.receipt-highlight-card {
  padding: 2.2cqw;
  border-radius: 1.4cqw;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.invoice.frame-9 .receipt-highlight-card {
  background: color-mix(in srgb, var(--accent) 24%, #181d2b);
  border: 0.22cqw solid var(--accent);
}
.receipt-highlight-card small {
  font-size: 1.4cqw;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
}
.receipt-highlight-card strong {
  font-size: 2.8cqw;
  font-weight: 900;
  margin: 1cqw 0;
}

.invoice.rcpt-2 .receipt-coupon-box {
  border: 0.3cqw dashed var(--accent);
  border-radius: 1.8cqw;
  padding: 2.6cqw;
  text-align: center;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  margin-bottom: 3cqw;
}
.invoice.rcpt-2 .receipt-coupon-amt {
  font-size: 4cqw;
  font-weight: 900;
  color: var(--accent);
  margin: 1cqw 0;
}

.invoice.rcpt-3 .receipt-top-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2.2cqw 2.6cqw;
  border-radius: 1.4cqw;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-bottom: 0.45cqw solid var(--accent);
  margin-bottom: 2.5cqw;
}

.invoice.rcpt-4 .receipt-box {
  border-radius: 0;
  border: 0.25cqw solid var(--ink);
  padding: 0;
  gap: 0;
}
.invoice.rcpt-4 .receipt-row {
  padding: 1.5cqw 2cqw;
  border-bottom: 0.16cqw solid color-mix(in srgb, var(--ink) 22%, transparent);
}
.invoice.rcpt-4 .receipt-row:last-child { border-bottom: 0; }

.invoice.rcpt-5 .receipt-box {
  border: 0;
  border-top: 0.3cqw double var(--accent);
  border-bottom: 0.3cqw double var(--accent);
  border-radius: 0;
  background: transparent;
}
.invoice.rcpt-5 .receipt-footer-grid {
  flex-direction: row-reverse;
}
.invoice.rcpt-5 .receipt-sign {
  text-align: left;
}
.invoice.rcpt-5 .receipt-sign .doc-signature-img {
  margin: 1.5cqw auto 0.4cqw 0;
}

/* ============ 8. NEW FAMILY ACCENTS (15 NEW CATEGORIES) ============ */
.invoice.arch .doc h1 { letter-spacing: 0.04em; text-transform: uppercase; font-weight: 800; }
.invoice.mono .head h2 { letter-spacing: 0.06em; text-transform: uppercase; }
.invoice.vintage .head h1 { font-style: italic; font-weight: 400; }
.invoice.pastel .doc-kpi-card,
.invoice.pastel .receipt-box,
.invoice.pastel .doc-side-col { border-radius: 2.4cqw; }
.invoice.glass .doc-side-col,
.invoice.glass .receipt-box { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent) 3%, transparent)); }
.invoice.noir th,
.invoice.noir .total { border-radius: 0.8cqw; }
