/* Take-payment sheet — shared by the Scheduler diary, the contact card and the
   phone portal. Self-contained and scoped under .cf-payment-sheet, exactly like
   signoff-ui.css: no host defines .booking-sheet styles of its own, so all three
   render identically rather than inheriting whatever the page happens to have. */

.cf-payment-sheet { position: fixed; inset: 0; z-index: 10001; display: flex; align-items: flex-end; justify-content: center; }
.cf-payment-sheet .booking-sheet__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.cf-payment-sheet .booking-sheet__panel {
  position: relative; background: #fff; width: 100%; max-width: 560px;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.15);
  font-family: inherit; color: #111827;
}
@media (min-width: 600px) {
  .cf-payment-sheet { align-items: center; }
  .cf-payment-sheet .booking-sheet__panel { border-radius: 16px; }
}
.cf-payment-sheet .booking-sheet__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.cf-payment-sheet .booking-sheet__title { font-size: 18px; font-weight: 700; }
.cf-payment-sheet .booking-sheet__when { font-size: 14px; color: #4b5563; margin-top: 2px; }
/* 44px, Apple's minimum for a fingertip — this sheet is operated one-handed on
   a doorstep. Measured at 28px by scripts/audit-touch-targets.mjs in GBU
   Scheduler, which fails the build under 44. The glyph stays 26px; it is the
   HIT AREA that grows. */
.cf-payment-sheet .booking-sheet__close {
  background: none; border: 0; font-size: 26px; line-height: 1; color: #6b7280; cursor: pointer;
  min-width: 44px; min-height: 44px; padding: 0;
}
.cf-payment-sheet .booking-cancel,
.cf-payment-sheet .booking-save { min-height: 44px; }
.cf-payment-sheet .pay-method { min-height: 44px; }
.cf-payment-sheet .pay-amount-wrap { min-height: 44px; }
.cf-payment-sheet .booking-field { display: flex; flex-direction: column; gap: 6px; }
.cf-payment-sheet .booking-field > span {
  font-size: 12px; font-weight: 700; color: #374151; text-transform: uppercase; letter-spacing: 0.04em;
}
.cf-payment-sheet .booking-sheet__foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 8px; }
/* The buttons are PINNED to the bottom on a phone (Allan, 25 Nov 2026): with
   the balance, the warning and the record form the sheet is taller than the
   screen, and "Record payment" sat at the end of the scroll, off the bottom.
   One rule pins every screen of this sheet. The bar runs edge to edge across
   the panel's side and bottom padding, white, so nothing shows through
   underneath — the deposit sheet's bar (deposit-ui.css). 🪤 bottom is MINUS
   the panel's bottom padding: a sticky bar is held inside the panel's CONTENT
   box, so at 0 the fields scrolled past in a 16px strip below the buttons.
   Phone only (upright, or under 520px tall): the desktop's centred sheet is
   unchanged. */
@media (max-width: 599.98px), (max-height: 520px) {
  .cf-payment-sheet .booking-sheet__foot {
    position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); z-index: 1;
    background: #fff; border-top: 1px solid #e5e7eb;
    margin: 0 -16px calc(-16px - env(safe-area-inset-bottom));
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
}
.cf-payment-sheet .booking-cancel {
  padding: 10px 16px; border-radius: 8px; border: 1px solid #d9e0e6;
  background: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.cf-payment-sheet .booking-save {
  padding: 10px 18px; border-radius: 8px; border: 0;
  background: #006aac; color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.cf-payment-sheet .booking-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── The balance, which is the whole point of the sheet ─────────────────── */
.pay-balance {
  padding: 14px 16px; border-radius: 10px; background: #f1f5f9;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.pay-balance__amount { font-size: 30px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.pay-balance__label { font-size: 13px; color: #475569; font-weight: 600; }
.pay-balance__meta { font-size: 13px; color: #475569; width: 100%; }

/* Status is never colour alone — every badge carries its own glyph and word,
   because Allan is colourblind and so are plenty of technicians. */
.pay-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
  border: 1px solid currentColor;
}
.pay-badge--paid   { color: #15803d; background: #f0fdf4; }
.pay-badge--part   { color: #b45309; background: #fffbeb; }
.pay-badge--draft  { color: #4b5563; background: #f3f4f6; }
.pay-badge--sent   { color: #006aac; background: #eff6ff; }
.pay-badge--void   { color: #b91c1c; background: #fef2f2; }

/* ── The three choices ──────────────────────────────────────────────────── */
.pay-choices { display: flex; flex-direction: column; gap: 8px; }
.pay-choice {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  padding: 13px 14px; border-radius: 10px; border: 1px solid #d9e0e6;
  background: #fff; font: inherit; color: inherit; cursor: pointer;
}
.pay-choice:hover:not(:disabled) { border-color: #006aac; background: #f8fbfd; }
.pay-choice:disabled { opacity: 0.55; cursor: not-allowed; }
.pay-choice__ico { font-size: 20px; line-height: 1.2; flex: none; }
.pay-choice__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pay-choice__title { font-weight: 700; font-size: 15px; }
.pay-choice__sub { font-size: 13px; color: #4b5563; line-height: 1.4; }

/* ── Test mode. Deliberately loud, and never colour alone. ──────────────── */
.pay-testbanner {
  padding: 9px 12px; border-radius: 8px;
  border: 2px dashed #7c3aed; background: #f5f3ff; color: #4c1d95;
  font-size: 13px; line-height: 1.45;
}

/* ── The permanence warning. The most important text in this file. ──────── */
.pay-warning {
  margin: 0; padding: 10px 12px; border-radius: 8px;
  border: 1px solid #f59e0b; background: #fffbeb; color: #78350f;
  font-size: 13px; line-height: 1.45;
}

/* ── The record form ────────────────────────────────────────────────────── */
.pay-row { display: flex; gap: 8px; align-items: center; }
.pay-method {
  padding: 10px 12px; border-radius: 8px; border: 1px solid #d9e0e6;
  font: inherit; background: #fff; width: 100%;
}
.pay-amount-wrap {
  display: flex; align-items: center; gap: 4px; flex: 1;
  padding: 0 10px; border-radius: 8px; border: 1px solid #d9e0e6; background: #fff;
}
.pay-amount-currency { color: #6b7280; font-weight: 600; }
.pay-amount { flex: 1; min-width: 0; border: 0; outline: none; padding: 10px 0; font: inherit; }
.pay-note {
  padding: 10px 12px; border-radius: 8px; border: 1px solid #d9e0e6;
  font: inherit; font-family: inherit; background: #fff; width: 100%; box-sizing: border-box;
  resize: vertical; min-height: 60px; max-height: 30vh;
}
.pay-back {
  align-self: flex-start; background: none; border: 0; padding: 4px 0;
  font: inherit; font-weight: 600; color: #6b7280; cursor: pointer;
}

/* ── Waiting for the customer to pay ────────────────────────────────────── */
.pay-wait { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 12px 8px; text-align: center; }
.pay-wait__spin {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid #e2e8f0; border-top-color: #006aac;
  animation: pay-spin 0.9s linear infinite;
}
@keyframes pay-spin { to { transform: rotate(360deg); } }
/* Respect a reduced-motion preference — the spinner is decoration, the words
   carry the meaning. */
@media (prefers-reduced-motion: reduce) { .pay-wait__spin { animation: none; } }
.pay-wait__title { font-size: 17px; font-weight: 700; }
.pay-wait__sub { font-size: 14px; color: #4b5563; line-height: 1.5; max-width: 34em; }
.pay-wait__warn { font-size: 13px; color: #b45309; }

/* Paid. Tick AND words AND the figure — never colour alone. */
.pay-done { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 12px 8px; text-align: center; }
.pay-done__tick {
  width: 46px; height: 46px; border-radius: 50%;
  background: #f0fdf4; color: #15803d; border: 2px solid #15803d;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; line-height: 1;
}
.pay-done__amount { font-size: 22px; font-weight: 800; }
.pay-done__sub { font-size: 14px; color: #4b5563; }

/* ── States ─────────────────────────────────────────────────────────────── */
.pay-msg { font-size: 14px; color: #4b5563; line-height: 1.5; }
.pay-msg--err { color: #b91c1c; }
.pay-blocked {
  padding: 12px 14px; border-radius: 8px; background: #f3f4f6;
  color: #374151; font-size: 14px; line-height: 1.5;
}
.pay-claim {
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid #f59e0b; background: #fffbeb; color: #78350f;
  font-size: 13px; line-height: 1.45;
}
