.receipt-open { overflow: hidden; }
.receipt-modal { position: fixed; inset: 0; z-index: 5000; display: none; place-items: center; padding: 20px; }
.receipt-modal.is-open { display: grid; }
.receipt-modal__backdrop { position: absolute; inset: 0; border: 0; background: rgba(15, 23, 42, .58); backdrop-filter: blur(3px); }
.receipt-modal__panel { position: relative; width: min(920px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: 20px; background: #f8fafc; box-shadow: 0 30px 90px rgba(15, 23, 42, .28); }
.receipt-editor { padding: 18px 24px 16px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.receipt-editor__toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; color: #475569; }
.receipt-editor__actions { display: flex; align-items: center; gap: 8px; }
.receipt-tool-btn, .receipt-close { border: 1px solid #dbe2ea; border-radius: 9px; background: #fff; color: #334155; font: inherit; cursor: pointer; }
.receipt-tool-btn { min-height: 38px; padding: 0 13px; font-weight: 600; }
.receipt-tool-btn--dark { border-color: #111827; background: #111827; color: #fff; }
.receipt-close { width: 38px; height: 38px; border-color: transparent; background: transparent; color: #94a3b8; font-size: 24px; }
.receipt-editor__label { display: block; margin: 0 0 7px; color: #64748b; font-size: 13px; }
.receipt-editor__input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #dbe2ea; border-radius: 9px; background: #fff; color: #0f172a; font: inherit; }
.receipt-editor__check { display: flex; align-items: flex-start; gap: 9px; margin-top: 11px; color: #475569; font-size: 13px; cursor: pointer; }
.receipt-editor__check input { margin: 2px 0 0; accent-color: #4f6ddf; }
.receipt-editor__check span { display: flex; flex-direction: column; gap: 2px; }
.receipt-editor__check small { color: #94a3b8; }
.receipt-preview-wrap { padding: 24px; background: #eef2f6; }
.payment-receipt { box-sizing: border-box; width: 100%; min-height: 760px; padding: 45px 42px 32px; background: #fff; color: #111827; font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; }
.payment-receipt__head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.payment-receipt__head h1 { margin: 0; font-size: 31px; letter-spacing: -.03em; }
.payment-receipt__head > strong { font-size: 23px; text-align: right; }
.payment-receipt__meta { margin: 42px 0 32px; }
.payment-receipt__meta div { display: flex; gap: 22px; margin: 5px 0; }
.payment-receipt__meta dt { width: 80px; font-weight: 700; }
.payment-receipt__meta dd { margin: 0; }
.payment-receipt__parties { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 38px; }
.payment-receipt__parties > div { display: flex; flex-direction: column; gap: 5px; }
.payment-receipt__parties > div:last-child { text-align: right; }
.payment-receipt__parties b { font-size: 13px; }
.payment-receipt__parties strong { font-size: 15px; }
.payment-receipt__parties span { color: #475569; font-size: 13px; }
.payment-receipt h2 { margin: 0 0 34px; font-size: 24px; }
.payment-receipt table { width: 100%; border-collapse: collapse; font-size: 13px; }
.payment-receipt th { padding: 11px 0; border-top: 1px solid #cbd5e1; border-bottom: 1px solid #cbd5e1; color: #64748b; font-weight: 500; text-align: left; }
.payment-receipt td { padding: 16px 0; border-bottom: 1px solid #e2e8f0; }
.payment-receipt th:nth-child(n+3), .payment-receipt td:nth-child(n+3) { text-align: right; }
.payment-receipt__totals { width: 230px; margin: 8px 0 0 auto; }
.payment-receipt__totals div { display: flex; justify-content: space-between; gap: 20px; padding: 7px 0; }
.payment-receipt__totals .is-paid { margin-top: 2px; border-top: 1px solid #cbd5e1; font-weight: 800; }
.payment-receipt footer { display: flex; justify-content: space-between; margin-top: 62px; padding-top: 15px; border-top: 1px solid #cbd5e1; color: #94a3b8; font-size: 11px; }
.receipt-loading { padding: 70px 24px; text-align: center; color: #64748b; }

@media (max-width: 640px) {
  .receipt-modal { padding: 0; }
  .receipt-modal__panel { max-height: 100vh; border-radius: 0; }
  .receipt-editor { padding: 14px; }
  .receipt-editor__toolbar { align-items: flex-start; }
  .receipt-editor__actions { flex-wrap: wrap; justify-content: flex-end; }
  .receipt-tool-btn { padding: 0 9px; font-size: 12px; }
  .receipt-preview-wrap { padding: 10px; overflow-x: auto; }
  .payment-receipt { min-width: 720px; }
}

@media print {
  body * { visibility: hidden !important; }
  #payment-receipt-printable, #payment-receipt-printable * { visibility: visible !important; }
  #payment-receipt-printable { position: fixed; inset: 0; width: 100%; min-height: 100%; padding: 14mm 12mm 10mm; }
  @page { size: A4; margin: 0; }
}
