/* print.css — print route: receipt 80mm + A4 (.pr-) */
body.print-mode { --ink: #000; --ink-soft: #333; --ink-faint: #666; --line: #cfcfcf; --bg: #fff; --surface: #fff; --aqua-tint: #f2f2f2; --aqua-text: #0f766e; background: #fff; color: #000; }
body.print-mode #app { padding: 0; }
.pr-doc { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #000; background: #fff; margin: 0 auto; line-height: 1.35; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pr-doc * { box-sizing: border-box; }

/* toolbar (screen only) */
.pr-toolbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; margin: 0 0 20px; background: #f6f6f6; border-bottom: 1px solid #ddd; }
.pr-toolbar .btn { color: #fff; }
.pr-toolbar .btn.btn-primary { color: #07333e; }
.pr-toolbar-layouts { display: inline-flex; gap: 6px; margin-left: auto; }
.pr-toolbar-layouts .btn { background: #fff; color: #000; border: 1px solid #ccc; }
.pr-toolbar-layouts .btn.is-active { background: #07333e; color: #fff; border-color: #07333e; }
.pr-toolbar svg { width: 18px; height: 18px; }

/* header */
.pr-head { display: grid; gap: 12px; }
.pr-clinic-name { font-weight: 700; font-size: 1.15em; }
.pr-clinic-line { font-size: .9em; color: #333; }
.pr-tin { font-weight: 600; color: #000; }
.pr-title h1 { font: inherit; font-weight: 800; font-size: 1.1em; margin: 0; text-transform: uppercase; letter-spacing: .04em; }
.pr-note { font-size: .82em; color: #444; }
.pr-void { display: inline-block; margin-top: 6px; padding: 4px 12px; border: 3px solid #000; font-weight: 900; letter-spacing: .12em; transform: rotate(-4deg); }
.pr-meta { display: grid; gap: 3px; font-size: .92em; }
.pr-row { display: flex; justify-content: space-between; gap: 12px; }
.pr-row .pr-k { color: #333; }
.pr-row .pr-v { font-variant-numeric: tabular-nums; text-align: right; }

/* lines */
.pr-lines { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .92em; }
.pr-lines th { text-align: left; font-weight: 700; padding: 6px 4px; border-bottom: 1px solid #000; font-size: .85em; text-transform: uppercase; letter-spacing: .04em; }
.pr-lines td { padding: 6px 4px; border-bottom: 1px solid #ddd; vertical-align: top; }
.pr-lines .pr-qty { text-align: center; width: 3em; }
.pr-lines .pr-unit, .pr-lines .pr-amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* totals, payments, scpwd, foot */
.pr-totals { display: grid; gap: 4px; padding-top: 6px; }
.pr-totals .pr-total { font-weight: 800; font-size: 1.2em; padding-top: 6px; border-top: 2px solid #000; margin-top: 4px; }
.pr-totals .pr-balance { font-weight: 700; }
.pr-payments, .pr-scpwd { margin-top: 14px; padding-top: 10px; border-top: 1px dashed #999; display: grid; gap: 4px; font-size: .92em; }
.pr-payments h2, .pr-scpwd h2 { font: inherit; font-weight: 700; margin: 0 0 4px; font-size: .95em; }
.pr-pay { display: grid; gap: 2px; }
.pr-change { color: #333; font-size: .92em; }
.pr-sign { margin-top: 30px; }
.pr-sign-line { border-bottom: 1px solid #000; height: 1px; margin-bottom: 4px; }
.pr-sign-label { font-size: .8em; color: #333; text-align: center; }
.pr-foot { margin-top: 18px; padding-top: 10px; border-top: 1px dashed #999; display: grid; gap: 6px; font-size: .85em; color: #333; }
.pr-notes { color: #000; }
.pr-printed { font-size: .8em; color: #666; }

/* receipt: 72mm column */
.pr-receipt { width: 72mm; max-width: 100%; padding: 6mm 0 10mm; font-size: 11.5px; }
.pr-receipt .pr-head { text-align: center; }
.pr-receipt .pr-meta { text-align: left; }
.pr-receipt .pr-lines th.pr-unit, .pr-receipt .pr-lines td.pr-unit { display: none; }
.pr-receipt .pr-foot { text-align: center; }
.pr-receipt .pr-toolbar { width: 100vw; margin-left: calc(50% - 50vw); }

/* A4 */
.pr-a4 { width: 182mm; max-width: 100%; padding: 8mm 0 14mm; font-size: 13.5px; }
.pr-a4 .pr-head { grid-template-columns: 1fr auto; grid-template-areas: "clinic title" "meta meta"; align-items: start; column-gap: 24px; }
.pr-a4 .pr-clinic { grid-area: clinic; }
.pr-a4 .pr-title { grid-area: title; text-align: right; }
.pr-a4 .pr-title h1 { font-size: 1.5em; }
.pr-a4 .pr-meta { grid-area: meta; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; padding: 10px 0; border-top: 1px solid #000; border-bottom: 1px solid #000; margin-top: 8px; }
.pr-a4 .pr-lines { margin: 20px 0; }
.pr-a4 .pr-totals { width: 60%; margin-left: auto; }
.pr-a4 .pr-payments, .pr-a4 .pr-scpwd { width: 60%; margin-left: auto; }
.pr-a4 .pr-scpwd .pr-sign { width: 70%; }
.pr-a4 .pr-toolbar { width: 100vw; margin-left: calc(50% - 50vw); }

@media screen {
  body.print-mode { background: #e9e9e9; }
  body.print-mode .pr-toolbar.no-print { display: flex !important; }
  .pr-doc { background: #fff; padding-left: 8mm; padding-right: 8mm; min-height: 100vh; box-shadow: 0 2px 20px rgba(0, 0, 0, .12); }
  .pr-receipt { width: 88mm; }
  .pr-a4 { width: 198mm; }
  .pr-doc .pr-toolbar { margin-left: -8mm; width: calc(100% + 16mm); }
}
@media screen and (max-width: 560px) {
  .pr-a4 { font-size: 12px; }
  .pr-a4 .pr-head { grid-template-columns: 1fr; grid-template-areas: "clinic" "title" "meta"; }
  .pr-a4 .pr-title { text-align: left; }
  .pr-a4 .pr-meta { grid-template-columns: 1fr; }
  .pr-a4 .pr-totals, .pr-a4 .pr-payments, .pr-a4 .pr-scpwd { width: 100%; }
}
@media print {
  html, body, body.print-mode { background: #fff !important; color: #000 !important; margin: 0; padding: 0; }
  #app { padding: 0 !important; }
  .no-print, .pr-toolbar, #drawer-root, #modal-root, #toast-root, .scrim, .drawer, .modal, .toast { display: none !important; }
  .pr-doc { width: 100%; max-width: none; margin: 0; padding: 0; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pr-receipt { font-size: 10.5px; }
  .pr-a4 { font-size: 12.5px; }
  .pr-lines tr { break-inside: avoid; }
  .pr-scpwd, .pr-foot { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
