/* Export is a separate document, rendered at 3x when canvas capacity allows. */
.bill-capture { position: absolute; top: 0; left: -10000px; width: 720px; pointer-events: none; }
.bill {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  width: 720px;
  padding: 24px;
  background: var(--j-bg, #fbfff4);
  color: var(--j-ink, #414e3d);
  font: 24px/1.5 var(--j-font, sans-serif);
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
}
.bill *, .bill *::before, .bill *::after { box-sizing: border-box; margin: 0; padding: 0; }
.bill-paper { position: relative; z-index: 1; padding: 28px 28px 24px; border: 1px solid var(--j-line, #e1e7d5); border-radius: 26px; background: var(--j-paper, #fffffb); }
.bill-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--j-line, #e1e7d5); }
.bill h1 { color: var(--j-green-dark, #4d653e); font-family: var(--j-heading-font); font-size: 43px; font-weight: 400; letter-spacing: 2px; line-height: 1.35; }
.bill-date { display: block; margin-top: 8px; color: var(--j-muted, #687361); font-size: 18px; letter-spacing: 1px; }
.bill-header-art { display: block; width: 100px; height: auto; max-width: none; }

.bill-section { margin-top: 24px; }
.bill-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.bill-section-heading h2 { display: flex; align-items: baseline; gap: 10px; color: var(--j-ink, #414e3d); font-family: var(--j-heading-font); font-size: 28px; font-weight: 400; letter-spacing: .6px; }
.bill-section-heading h2 i { color: var(--j-muted, #687361); font: 400 18px/1.5 "Melody Rounded", sans-serif; letter-spacing: 1px; }
.bill-section-heading > span { color: var(--j-muted, #687361); font-size: 20px; }
.bill-section-heading > span b { color: var(--j-green-dark, #4d653e); font-weight: 600; }
.bill-record { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; color: var(--j-muted, #687361); font-size: 20px; }
.bill-record b { color: var(--j-green, #71875b); font-weight: 600; }

.bill-medals { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; text-align: center; }
.bill-medals th, .bill-medals td { padding: 6px 5px; font-size: 24px; line-height: 1.45; font-weight: 400; }
.bill-medals thead { color: var(--j-muted, #687361); }
.bill-medals thead th { font-size: 20px; padding-block: 9px; background: var(--j-field, #f4f6ed); }
.bill-medals thead th:first-child { border-radius: 11px 0 0 11px; }
.bill-medals thead th:last-child { border-radius: 0 11px 11px 0; }
.bill-medals th:first-child { text-align: left; padding-left: 13px; }
.bill-medals tbody tr + tr > * { border-top: 1px solid var(--j-soft-line, #edf0e5); }
.bill-medals .bill-stars { color: var(--j-green-dark, #4d653e); font-weight: 600; }
.bill-coefficients { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 15px; padding-top: 10px; margin-top: 2px; border-top: 1px solid var(--j-line, #e1e7d5); color: var(--j-muted, #687361); font-size: 18px; }
.bill-coefficients > span { white-space: nowrap; }
.bill-coefficients b { font-weight: 400; }

.bill-payments { margin-top: 26px; }
.bill-payments .bill-section-heading { margin-bottom: 16px; }
.bill-payment-list { display: grid; gap: 16px; }
.bill-payment { min-width: 0; padding: 16px; border: 1px solid var(--j-line, #e1e7d5); border-radius: 17px; background: var(--j-paper, #fffffb); }
.bill-pay-row { display: grid; grid-template-columns: minmax(0,.8fr) minmax(0,1.4fr) minmax(0,1.25fr); align-items: center; gap: 12px; }
.bill-pay-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.bill-pay-name { min-width: 0; color: var(--j-ink, #414e3d); font-size: 26px; line-height: 1.35; font-weight: 400; }
.bill-pay-name small { display: block; font-size: 16px; color: var(--j-muted, #687361); font-weight: 400; white-space: nowrap; }
.bill-pay-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; font-size: 18px; color: var(--j-muted, #687361); line-height: 1.45; }
.bill-pay-meta span { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.bill-pay-meta b { color: var(--j-amount-ink, #52604a); font-size: 22px; font-weight: 400; overflow-wrap: anywhere; }
.bill-balance { display: inline-flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 6px; min-width: 0; padding: 8px 10px; border-radius: 12px; text-align: center; }
.bill-balance small { font-size: 21px; }
.bill-balance b { min-width: 0; font-size: 34px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.bill-balance i { font-size: 19px; margin-right: 3px; font-style: normal; font-weight: 400; }
.bill-balance.refund { color: #2f6a94; background: #e3f0f8; }
.bill-balance.payin { color: #a2552f; background: #fdeadf; }
.bill-balance.even { color: var(--j-muted, #687361); background: var(--j-field, #f4f6ed); font-size: 23px; }

/* One deposit and balance per role, followed by its own calculation. */
.bill-calculation { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--j-detail-bg, #f8faf4); }
.bill-calc-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 3px 12px; font-size: 18px; color: var(--j-detail-ink, #626f59); }
.bill-calc-heading strong { font-size: 18px; font-weight: 400; color: var(--j-detail-ink, #626f59); }
.bill-quote-line { display: grid; grid-template-columns: repeat(var(--bill-players),minmax(0,1fr)); gap: 5px 12px; }
.bill-calc-heading + .bill-quote-line { margin-top: 5px; }
.bill-quote-line > span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 7px; min-width: 0; }
.bill-quote-line small { color: var(--j-detail-ink, #626f59); font-size: 19px; white-space: nowrap; }
.bill-quote-line b { color: var(--j-amount-ink, #52604a); font-size: 21px; font-weight: 400; overflow-wrap: anywhere; }
.bill-formula { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 3px 10px; margin-top: 5px; color: var(--j-detail-ink, #626f59); font-size: 19px; line-height: 1.6; }
.bill-formula > span { overflow-wrap: anywhere; }
.bill-formula b { color: var(--j-amount-ink, #52604a); font-size: 19px; font-weight: 400; white-space: nowrap; }

.bill-income { padding: 22px; border: 1px solid var(--j-line, #e1e7d5); border-radius: 19px; background: var(--j-green-soft, #edf2e2); }
.bill-income .bill-section-heading { margin-bottom: 16px; }
.bill-income h2 { color: var(--j-green-dark, #4d653e); }
.bill-income-people { display: grid; grid-template-columns: repeat(var(--bill-players),minmax(0,1fr)); gap: 17px; }
.bill-income-people > div { min-width: 0; }
.bill-income-people > div + div { padding-left: 15px; border-left: 1px solid var(--j-accent-line, #d3dec2); }
.bill-income-people span { display: block; font-size: 22px; color: var(--j-muted, #687361); }
.bill-income-people strong { display: block; margin-top: 6px; color: var(--j-green-dark, #4d653e); font-size: 36px; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.bill-income-people strong small { font-size: 19px; margin-right: 3px; font-weight: 400; }
.bill[data-car="41"] .bill-income-people { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 23px; }
.bill[data-car="41"] .bill-income-people > div { display: flex; align-items: baseline; justify-content: space-between; gap: 11px; padding-left: 0; border: 0; }
.bill[data-car="41"] .bill-income-people strong { margin-top: 0; }
.bill-footer { display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 24px; color: var(--j-muted, #687361); font-family: var(--j-font); font-size: 18px; letter-spacing: .6px; }
.bill-footer::before { content: ''; width: 2.8em; height: 1px; margin-bottom: 10px; background: var(--j-accent-line, #d3dec2); }

/* Scrapbook skin: gingham mat, die-cut paper, washi tape. Colours only; layout above is untouched. */
:root.journal-theme {
  --b-check: rgba(240, 172, 194, .44);
  --b-dot: rgba(150, 200, 238, .55);
  --b-stroke: #ab6273;
  --b-tape: rgba(248, 214, 120, .9);
  --b-tape-line: rgba(255, 255, 255, .55);
}
:root.journal-theme[data-theme="blue"] {
  --b-check: rgba(150, 200, 238, .45);
  --b-dot: rgba(240, 170, 192, .5);
  --b-stroke: #5f7388;
}
.bill {
  padding: 40px 30px 34px;
  background-color: var(--j-bg, #fffaf6);
  background-image:
    linear-gradient(90deg, var(--b-check) 50%, transparent 50%),
    linear-gradient(var(--b-check) 50%, transparent 50%);
  background-size: 36px 36px;
}
.bill::before { display: none; }
.bill-paper {
  border: 9px solid #fff;
  border-radius: 34px;
}
/* The die-cut look: a white sticker edge outside, the hand-drawn stroke just inside it. */
.bill-paper::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border: 2px solid var(--b-stroke);
  border-radius: 25px;
  pointer-events: none;
}
.bill-paper::before {
  content: '';
  position: absolute;
  top: -34px;
  left: 50%;
  z-index: 1;
  width: 168px;
  height: 38px;
  margin-left: -84px;
  background-color: var(--b-tape);
  background-image: linear-gradient(90deg, var(--b-tape-line) 50%, transparent 50%);
  background-size: 14px 14px;
  transform: rotate(-2.5deg);
}
.bill-header { border-bottom: 2px dashed var(--j-accent-line, #eccdd3); }
.bill-header-art { width: 150px; margin-block: -14px; }
.bill-section-heading h2 { align-items: center; }
.bill-section-heading h2 i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--b-stroke);
  border-radius: 50%;
  background: var(--j-green-soft, #fbeaee);
  color: var(--j-green-dark, #93405f);
  font-weight: 600;
  letter-spacing: 0;
}
.bill-medals thead th {
  background-color: var(--j-green-soft, #fbeaee);
  color: var(--j-green-dark, #93405f);
}
.bill-coefficients { border-top: 2px dashed var(--j-line, #f3dfe1); }
.bill-payment {
  border: 2px dashed var(--j-accent-line, #eccdd3);
  border-radius: 20px;
}
.bill-balance {
  border: 2px solid currentColor;
  border-radius: 16px;
}
.bill-balance.even { border-style: dashed; }
.bill-calculation { border-radius: 12px; }
.bill-income {
  border: 2px solid var(--b-stroke);
  border-radius: 22px;
  background-color: var(--j-paper, #fffefb);
  background-image: linear-gradient(transparent 92%, var(--b-dot) 92%);
  background-size: 100% 26px;
}
.bill-income-people > div {
  padding: 10px 14px;
  border: 2px solid var(--b-stroke);
  border-radius: 16px;
  background: var(--j-paper, #fffefb);
}
.bill-income-people > div + div { padding-left: 14px; border-left: 2px solid var(--b-stroke); }
.bill-footer::before {
  width: 96px;
  height: 0;
  border-top: 5px dotted var(--j-accent-line, #eccdd3);
  background: none;
}
