#course-booking-dialog,
.booking-slip-viewer {
  color: var(--tx);
  background: var(--bg, #fff);
  border: 1px solid var(--bd);
  border-radius: 16px;
  padding: 0;
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
}
#course-booking-dialog::backdrop,
.booking-slip-viewer::backdrop { background: rgba(15, 23, 42, .65); }
#course-booking-form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
#course-booking-form header,
#course-booking-form footer { display: flex; align-items: center; gap: 12px; padding: 16px; flex-shrink: 0; }
#course-booking-form header { justify-content: space-between; border-bottom: 1px solid var(--bd); }
#course-booking-form footer { justify-content: flex-end; border-top: 1px solid var(--bd); }
#course-booking-form h2 { margin: 0; font-size: 1.25rem; }
#course-booking-form .cb-body { padding: 16px; overflow-y: auto; min-height: 0; }
#course-booking-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
#course-booking-form label { display: block; font-size: 13px; margin-bottom: 12px; }
#course-booking-form input,
#course-booking-form select,
#course-booking-form textarea { box-sizing: border-box; width: 100%; padding: 10px; border: 1px solid var(--bd); border-radius: 8px; background: var(--bg, #fff); color: var(--tx); font: inherit; margin-top: 6px; }
#course-booking-form .cb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
#course-booking-error { color: var(--er, #b91c1c); white-space: pre-wrap; }
#course-booking-success { color: var(--p); padding: 16px; }
#course-booking-total { font-weight: 800; }
#course-booking-preview { max-width: 100%; max-height: 240px; object-fit: contain; }
.booking-slip-viewer { padding: 16px; }
.booking-slip-viewer img { display: block; max-width: 100%; margin: 16px auto 0; }
.booking-history { border: 1px solid var(--bd); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.booking-history h3 { font-size: 16px; margin-top: 0; }
.booking-history p { font-size: 13px; }
.booking-history { overflow-wrap: anywhere; }
.payment-history-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.payment-history-note { white-space: pre-wrap; }
.payment-history-status.pending { color: #b45309; }
.payment-history-status.approved { color: #15803d; }
.payment-history-status.rejected { color: #b91c1c; }
.customer-slip-viewer { border: 1px solid var(--bd); border-radius: 12px; padding: 16px; max-width: calc(100vw - 32px); }
.customer-slip-viewer::backdrop { background: rgba(15, 23, 42, .65); }
.customer-slip-viewer img { display: block; max-width: 100%; max-height: 75dvh; margin-bottom: 12px; }
#course-booking-dialog [hidden] { display: none !important; }
#payment-course-form #course-booking-dialog {
  width: 100%;
  max-height: none;
}
#payment-course-form #course-booking-form { max-height: none; }
@media (max-width: 520px) { #course-booking-form .cb-grid { grid-template-columns: 1fr; } }

/* Global .bo/.bp are styled for the dark hero; restyle them on light surfaces */
#pg-payment .bo,
#pg-cart .bo,
#pg-cart .bp,
#payHistoryList .bo,
#bookingHistoryList .bo,
#course-booking-dialog .bo,
.booking-slip-viewer .bo,
.customer-slip-viewer .bo {
  padding: 8px 18px;
  background: #fff;
  color: var(--pd);
  border: 1.5px solid var(--p);
  font-family: inherit;
  text-decoration: none;
}
#pg-cart .bp,
#course-booking-dialog .bp {
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--p), var(--pd));
  color: #fff;
  font-family: inherit;
  box-shadow: 0 6px 16px rgba(var(--p-rgb), .3);
}
#pg-payment .bo:hover,
#pg-cart .bo:hover,
#payHistoryList .bo:hover,
#bookingHistoryList .bo:hover,
#course-booking-dialog .bo:hover,
.booking-slip-viewer .bo:hover,
.customer-slip-viewer .bo:hover { background: var(--pl2); }
#pg-payment .bo:disabled,
#payHistoryList .bo:disabled,
#bookingHistoryList .bo:disabled,
#course-booking-dialog .bo:disabled,
#course-booking-dialog .bp:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
body.dark #pg-payment .bo,
body.dark #pg-cart .bo,
body.dark #payHistoryList .bo,
body.dark #bookingHistoryList .bo,
body.dark #course-booking-dialog .bo,
body.dark .booking-slip-viewer .bo,
body.dark .customer-slip-viewer .bo { background: transparent; color: #67e8f9; border-color: var(--pdd); }
.payment-history-actions .bo { margin: 0; }

/* Inline course booking on the payment page */
#course-booking-success {
  margin: 0 0 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  background: #ecfdf5;
  color: #047857;
  font-weight: 600;
  overflow-wrap: anywhere;
}
#course-booking-success strong { font-size: 1.05rem; }
#course-booking-success code { padding: 2px 8px; border-radius: 6px; background: #fff; color: #0f766e; font-weight: 800; }
#course-booking-error { margin: 0 0 12px; padding: 10px 14px; border: 1px solid #fecaca; border-radius: 10px; background: #fef2f2; }
#course-booking-error[hidden] { display: none; }
#course-booking-total { margin: 8px 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--pl2); color: var(--pdd); }
body.dark #course-booking-success { background: #064e3b; border-color: #047857; color: #a7f3d0; }
body.dark #course-booking-success code { background: #0f172a; color: #67e8f9; }
body.dark #course-booking-error { background: #450a0a; border-color: #991b1b; }
body.dark #course-booking-total { background: #164e63; color: #a5f3fc; }#payment-course-form #course-booking-dialog {
  max-width: 820px;
  margin: 1.5rem auto;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(var(--p-rgb), .14);
}
#course-booking-form input[type="file"] { padding: 8px; background: var(--pl2); border-style: dashed; cursor: pointer; }