/* Invoice overlay. The toolbar follows the console's dark theme; the sheet is a
   fixed light "paper" so it looks the same on screen, in print and in the PDF. */
.inv-overlay{position:fixed;inset:0;z-index:1000;display:flex;flex-direction:column;background:rgba(10,10,11,.92);color:var(--text-hi)}
.inv-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;padding:12px 20px;background:var(--surface-1);border-bottom:1px solid var(--hairline-strong)}
.inv-toolbar-title{display:flex;align-items:center;gap:16px;font-size:14px;min-width:0}
.inv-switch{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--text-mid)}
.inv-switch select{font:inherit;font-size:12px;color:var(--text-hi);background:var(--surface-2);border:1px solid var(--hairline-strong);border-radius:8px;padding:7px 10px;cursor:pointer}
.inv-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.inv-note{padding:9px 20px;font-size:12px;background:var(--accent-wash);color:var(--text-hi);border-bottom:1px solid var(--hairline)}
.inv-scroll{flex:1;overflow:auto;padding:28px 20px 48px}
.inv-state{max-width:420px;margin:80px auto;text-align:center;color:var(--text-mid)}
.inv-state h2{font-size:16px;font-weight:500;color:var(--text-hi);margin:0 0 8px}
.inv-state p{font-size:13px;margin:0 0 18px}
.inv-loader{margin:0 auto 14px;width:22px;height:22px;border:2px solid var(--hairline-strong);border-top-color:var(--accent);border-radius:50%;animation:inv-spin 1s linear infinite}
@keyframes inv-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.inv-loader{animation:none}}

/* The sheet: A4 proportions at 96dpi (794px wide). */
.inv-sheet{box-sizing:border-box;width:794px;min-height:1123px;margin:0 auto;padding:48px 52px;display:flex;flex-direction:column;background:#fff;color:#1b1f24;font-family:"Open Sans","Inter",system-ui,sans-serif;font-size:12.5px;line-height:1.5;box-shadow:0 20px 60px -20px rgba(0,0,0,.6)}
.inv-sheet *{box-sizing:border-box}
.inv-head{display:flex;justify-content:space-between;gap:32px;padding-bottom:24px;border-bottom:2px solid #1b1f24}
.inv-gym{display:flex;gap:16px;min-width:0}
.inv-logo{width:64px;height:64px;flex:none;border-radius:10px;object-fit:cover}
.inv-logo-text{display:flex;align-items:center;justify-content:center;background:#1b1f24;color:#fff;font-size:20px;font-weight:700;letter-spacing:1px}
.inv-gym-name{font-size:19px;font-weight:700;line-height:1.25;margin-bottom:4px}
.inv-gym-line{color:#4f5762;font-size:12px;max-width:330px}
.inv-title{text-align:right;flex:none}
.inv-title h1{margin:0 0 10px;font-size:26px;font-weight:800;letter-spacing:3px;line-height:1;color:#1b1f24}
.inv-meta{display:flex;justify-content:flex-end;gap:10px;font-size:12px}
.inv-meta span{color:#6b7480}
.inv-meta strong{min-width:96px;font-weight:600}
.inv-status{display:inline-block;margin-top:10px;padding:3px 10px;border-radius:999px;font-size:10.5px;font-weight:700;letter-spacing:.6px;text-transform:uppercase}
.inv-status-paid{background:#e3f6e8;color:#146c2e}
.inv-status-partially{background:#fff1d6;color:#8a5a00}
.inv-status-unpaid{background:#fde4e4;color:#a11919}
.inv-parties{display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:24px;padding:24px 0}
.inv-label{font-size:9.5px;font-weight:700;letter-spacing:1.2px;text-transform:uppercase;color:#8a929c;margin-bottom:6px}
.inv-party-name{font-size:14px;font-weight:600;margin-bottom:4px;overflow-wrap:anywhere}
.inv-party-line{color:#2b3138;font-size:12px}
.inv-party-line span{display:inline-block;min-width:84px;color:#6b7480}
.inv-items{width:100%;border-collapse:collapse}
.inv-items th{padding:9px 12px;background:#1b1f24;color:#fff;font-size:10px;font-weight:600;letter-spacing:.8px;text-transform:uppercase;text-align:left}
.inv-items td{padding:12px;border-bottom:1px solid #e3e6ea;vertical-align:top}
.inv-num{width:40px;color:#6b7480}
.inv-amount{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.inv-items th.inv-amount{text-align:right}
.inv-item-name{font-weight:600}
.inv-item-note{color:#6b7480;font-size:11.5px;margin-top:2px}
.inv-bottom{display:flex;justify-content:space-between;gap:32px;padding-top:20px}
.inv-notes{flex:1;min-width:0;color:#2b3138;font-size:12px}
.inv-note-block{margin-bottom:16px;overflow-wrap:anywhere}
.inv-payments{border-collapse:collapse;font-size:11.5px}
.inv-payments td{padding:3px 14px 3px 0;color:#4f5762}
.inv-payments .inv-current td{color:#1b1f24;font-weight:600}
.inv-totals{width:290px;flex:none;font-variant-numeric:tabular-nums}
.inv-totals>div{display:flex;justify-content:space-between;gap:16px;padding:5px 0;color:#2b3138}
.inv-totals>div>span:first-child{color:#6b7480}
.inv-totals .inv-total{margin-top:4px;padding-top:9px;border-top:1px solid #c9ced5;font-size:14px;font-weight:700;color:#1b1f24}
.inv-totals .inv-total>span:first-child{color:#1b1f24}
.inv-totals .inv-balance{margin-top:6px;padding:10px 12px;background:#1b1f24;color:#fff;border-radius:6px;font-size:14px;font-weight:700}
.inv-totals .inv-balance>span:first-child{color:#fff}
/* The gym's own texts from Settings: line breaks are kept as typed. */
.inv-texts{margin-top:22px;display:flex;flex-direction:column;gap:14px}
.inv-text-body{white-space:pre-line;color:#2b3138;font-size:11.5px;line-height:1.6;overflow-wrap:anywhere}
.inv-foot{margin-top:auto;padding-top:20px;border-top:1px solid #e3e6ea;display:flex;justify-content:space-between;gap:24px;color:#8a929c;font-size:10.5px}

/* "Invoice" card on the Settings page; matches that page's own cards. */
.inv-settings{display:flex;flex-direction:column;gap:var(--space-4);padding:var(--space-5);border-radius:var(--radius-md);background:var(--surface-1)}
.inv-settings-title{font-size:var(--fs-small);font-weight:700;color:var(--text-mid);text-transform:uppercase;letter-spacing:.06em}
.inv-settings-sub{margin:-8px 0 0;color:var(--text-mid);font-size:var(--fs-small)}
.inv-settings-field{display:flex;flex-direction:column;gap:6px}
.inv-settings-label{display:flex;align-items:baseline;justify-content:space-between;font-size:var(--fs-small);font-weight:600;color:var(--text-hi)}
.inv-settings-label small{font-size:var(--fs-micro);font-weight:400;color:var(--text-lo);font-variant-numeric:tabular-nums}
.inv-settings textarea{box-sizing:border-box;width:100%;min-height:64px;padding:10px 12px;font:inherit;font-size:var(--fs-small);line-height:1.5;color:var(--text-hi);background:var(--surface-2);border:1px solid var(--hairline-strong);border-radius:var(--radius-sm);resize:vertical}
.inv-settings textarea:focus{outline:none;border-color:var(--accent)}
.inv-settings textarea:disabled{opacity:.6}
.inv-settings-hint{font-size:var(--fs-micro);color:var(--text-lo)}
.inv-settings-foot{display:flex;align-items:center;justify-content:space-between;gap:var(--space-4)}
.inv-settings-message{font-size:var(--fs-small);color:var(--text-mid)}
.inv-settings-ok{color:var(--success)}
.inv-settings-error{color:var(--danger)}

/* Print: only the sheet, on white, at the printer's own A4 margins. */
@media print{
  @page{size:A4;margin:12mm}
  /* The console is a dark theme; without this the page margins print dark. */
  :root{color-scheme:light!important;background:#fff!important}
  html,body{background:#fff!important;height:auto!important;overflow:visible!important}
  body>*:not(.inv-overlay){display:none!important}
  .inv-overlay{position:static!important;display:block!important;background:#fff!important}
  .inv-toolbar,.inv-note{display:none!important}
  .inv-scroll{overflow:visible!important;padding:0!important}
  .inv-sheet{width:100%!important;min-height:0!important;margin:0!important;padding:0 4px!important;box-shadow:none!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
