@page { size: A4 portrait; margin: 16mm; }
/* Printable invoice / receipt — R-Code brand, A4-friendly */
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #1D1B2E; background: #F4F3FA; }
.doc-bar { max-width: 820px; margin: 16px auto 0; padding: 0 16px; text-align: right; }
.doc-btn { padding: 10px 18px; font: inherit; font-weight: 600; color: #fff; background: #4D44C5; border: 0; border-radius: 10px; cursor: pointer; }
.doc-btn:hover { background: #3D35A8; }
.doc { position: relative; overflow: hidden; max-width: 820px; margin: 16px auto 40px; padding: 40px; background: #fff; border-radius: 16px; box-shadow: 0 8px 30px rgba(29, 27, 46, .08); }
.doc-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 3px solid #4D44C5; }
.doc-brand { display: flex; gap: 12px; align-items: flex-start; }
.doc-brand strong { display: block; font-size: 18px; }
.doc-brand small { display: block; color: #667085; }
.doc-title { text-align: right; }
.doc-title h1 { margin: 0; font-size: 26px; color: #4D44C5; letter-spacing: .02em; text-transform: uppercase; }
.doc-title p { margin: 2px 0 8px; font-weight: 600; }
.doc-stamp { display: inline-block; padding: 4px 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border: 2px solid currentColor; border-radius: 999px; color: #B54708; }
.doc-stamp--paid { color: #067647; }
.doc-stamp--void, .doc-stamp--draft { color: #667085; }
.doc-stamp--overdue { color: #B42318; }
.doc-meta { display: flex; justify-content: space-between; gap: 24px; margin: 24px 0; }
.doc-meta h2, .doc h2 { margin: 24px 0 8px; font-size: 12px; color: #667085; text-transform: uppercase; letter-spacing: .06em; }
.doc-meta h2 { margin-top: 0; }
.doc-meta p { margin: 0 0 6px; }
.doc-meta dl { display: grid; grid-template-columns: auto auto; gap: 4px 16px; margin: 0; }
.doc-meta dt { color: #667085; }
.doc-meta dd { margin: 0; font-weight: 600; text-align: right; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th { padding: 10px 8px; font-size: 12px; text-align: left; color: #667085; text-transform: uppercase; letter-spacing: .04em; background: #F4F3FA; }
.doc-table td { padding: 10px 8px; border-bottom: 1px solid #EAECF0; vertical-align: top; }
.doc-table .num { text-align: right; white-space: nowrap; }
.doc-void td { color: #98A2B3; text-decoration: line-through; }
.doc-totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; max-width: 360px; margin: 20px 0 0 auto; }
.doc-totals dt { color: #667085; }
.doc-totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.doc-totals .doc-grand { padding-top: 6px; font-size: 16px; font-weight: 700; color: #1D1B2E; border-top: 1px solid #EAECF0; }
.doc-totals--receipt { max-width: 440px; margin-top: 32px; }
.doc-notes { margin-top: 28px; padding: 16px; background: #F7F6FE; border-radius: 12px; }
.doc-notes p { margin: 0 0 6px; }
.doc-pre { white-space: pre-wrap; }
.doc-muted { color: #667085; }
.doc-foot { margin-top: 32px; font-size: 13px; text-align: center; }
@media (max-width: 640px) {
  .doc { padding: 20px 16px; border-radius: 0; margin-top: 8px; }
  .doc-head, .doc-meta { flex-direction: column; }
  .doc-title { text-align: left; }
  .doc-table { font-size: 13px; }
}
@media print {
  body { background: #fff; }
  .doc-bar { display: none; }
  .doc { margin: 0; padding: 0; max-width: none; box-shadow: none; border-radius: 0; }
  .doc-btn { display: none; }
  .doc-head, .doc-meta, .doc-totals, .doc-table tr { break-inside: avoid; }
  .doc-head { border-bottom-color: #4D44C5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-table th, .doc-notes { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- certificate (print) and public verification ---- */
.verify { max-width: 560px; margin: 40px auto; padding: 32px 28px; text-align: center; background: #fff; border-radius: 16px; box-shadow: 0 8px 30px rgba(29, 27, 46, .08); }
.verify h1 { margin: 12px 0 18px; font-size: 24px; }
.verify__box { margin: 0 0 22px; padding: 18px; border-radius: 12px; }
.verify__box--ok { background: #ECFDF3; border: 1px solid #A6F4C5; }
.verify__box--bad { background: #FEF3F2; border: 1px solid #FECDCA; }
.verify__state { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.verify__box--ok .verify__state { color: #067647; } .verify__box--bad .verify__state { color: #B42318; }
.verify__name { margin: 0; font-size: 26px; font-weight: 700; color: #1D1B2E; overflow-wrap: anywhere; }
.verify__meta { margin: 6px 0 0; color: #475467; }
.verify__bad { color: #B42318; }
.verify__form { display: grid; gap: 8px; margin: 12px 0 18px; text-align: left; }
.verify__form label { font-weight: 600; }
.verify__form input { padding: 12px 14px; font: inherit; letter-spacing: .06em; text-transform: uppercase; border: 1px solid #D0D5DD; border-radius: 10px; }
.verify code { background: #F4F3FA; padding: 1px 6px; border-radius: 6px; }
.verify__card { margin: 16px 0; padding: 16px 18px; text-align: left; border: 1px solid #E1E0EC; border-radius: 12px; }
.verify__card h2 { margin: 0 0 6px; font-size: 17px; }

/* ---- certificate (web view; mirrors the PDF) ---- */
.cert { container-type: inline-size; position: relative; width: min(100%, 1000px); aspect-ratio: 297 / 210; margin: 24px auto 40px; background: #fff; overflow: hidden; box-shadow: 0 10px 40px rgba(29, 27, 46, .14); color: #22222C; }
.cert::before { content: ""; position: absolute; inset: 0; background: url("../images/rct-watermark.png") center / 62% auto no-repeat; opacity: .075; pointer-events: none; }
.cert__art { position: absolute; inset: 0; width: 100%; height: 100%; }
.cert__content { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 4.6cqw 12cqw 0; text-align: center; }
.cert__logo { width: 24cqw; height: auto; margin: 0 0 1.6cqw; }
.cert__title { margin: 0; font: 700 4.5cqw/1.05 Helvetica, Arial, sans-serif; letter-spacing: .01em; }
.cert__sub { margin: .6cqw 0 0; font-size: 1.9cqw; letter-spacing: .02em; }
.cert__lead { margin: 1.3cqw 0 0; font-size: 1.55cqw; color: #464655; }
.cert__lead--below { margin-top: .8cqw; }
.cert__name { min-width: 42%; margin: .8cqw 0 0; padding: 0 2cqw 1cqw; font: italic 700 3.6cqw/1.15 Georgia, "Times New Roman", serif; color: #14142B; border-bottom: .15cqw solid #4D44C5; overflow-wrap: anywhere; }
.cert__course { margin: .8cqw 0 0; font: 700 2.5cqw/1.2 Helvetica, Arial, sans-serif; color: #4D44C5; overflow-wrap: anywhere; }
.cert__details { display: flex; flex-wrap: wrap; justify-content: center; gap: .4cqw 2.6cqw; margin: .9cqw 0 0; padding: 0; list-style: none; font-size: 1.3cqw; font-weight: 700; color: #2D2D3C; }
.cert__details li::before { content: "\2022\00a0"; color: #4D44C5; }
.cert__verify { position: absolute; left: 0; right: 0; bottom: 5.2cqw; margin: 0; padding: 0 14cqw; font-size: .95cqw; color: #6E6E82; word-break: break-all; }
.cert__stamp { position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg); margin: 0; padding: .4cqw 3cqw; font: 800 8cqw/1.2 Arial, sans-serif; letter-spacing: .08em; color: rgba(180, 35, 24, .55); border: .7cqw solid rgba(180, 35, 24, .55); border-radius: 1cqw; pointer-events: none; }
.cert--revoked .cert__name, .cert--revoked .cert__course { text-decoration: line-through; text-decoration-color: rgba(180, 35, 24, .5); }
@media (max-width: 640px) { .cert { margin: 12px auto 24px; } }
@media print { .cert { width: 100%; margin: 0; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; } .verify { box-shadow: none; } }
@page cert { size: A4 landscape; margin: 0; }
.cert { page: cert; }
a.doc-btn { display: inline-block; text-decoration: none; }
.cert__seal { position: absolute; left: 50%; top: 42.8cqw; width: 7.8cqw; height: 7.8cqw; transform: translateX(-50%); }
.cert__seal svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cert__seal img { position: absolute; left: 24%; top: 29%; width: 52%; height: auto; }
.cert__foot { position: absolute; left: 0; right: 0; bottom: 7.6cqw; height: 17cqw; }
.cert__sign { position: absolute; bottom: 0; width: 21cqw; display: grid; justify-items: center; align-items: end; font-size: 1.25cqw; }
.cert__sign--left { left: 10.1cqw; } .cert__sign--right { right: 10.1cqw; }
.cert__sign strong { font-size: 1.3cqw; }
.cert__sign small { color: #5F5F73; font-size: 1.05cqw; }
.cert__sigimg { display: block; width: 15cqw; height: 5.2cqw; object-fit: contain; }
.cert__signline { width: 20.5cqw; border-top: .1cqw solid #6E6E82; margin-bottom: .5cqw; }
.cert__id { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); display: grid; justify-items: center; gap: .4cqw; width: 34cqw; font-size: 1.15cqw; }
.cert__id small { color: #6B6B80; font-size: .95cqw; }
.cert__qr { width: 6.2cqw; height: 6.2cqw; }

/* receipt watermark: the full R-Code logo, large and faint behind the details */
.doc-watermark { position: absolute; z-index: 0; left: 50%; top: 52%; width: 74%; max-width: 600px; transform: translate(-50%, -50%) rotate(-12deg); opacity: .08; pointer-events: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc > *:not(.doc-watermark) { position: relative; z-index: 1; }

/* certificate with a partner: two logos side by side */
.cert__brands { display: flex; align-items: center; justify-content: center; gap: 2.4cqw; margin: 0 0 .4cqw; }
.cert__logo--pair { width: 21cqw; margin: 0; }
.cert__brands-line { width: .12cqw; height: 6.4cqw; background: #C9C9D6; }
.cert__partner { max-width: 21cqw; max-height: 7cqw; width: auto; height: auto; object-fit: contain; }
.cert__with { margin: 0 0 .8cqw; font-size: 1cqw; letter-spacing: .08em; text-transform: uppercase; color: #6E6E82; }
