
  /* The certificate is always paper, whatever the lighting. Paper has no dark mode. */
  :root { --paper: #f7f5ef; --ink: #1c2030; --rule: #cfcabb; --seal: #4c5bd4; --soft: rgba(28, 32, 48, 0.64); --ratio: 1.36; }
  .certificate-page .cert { background: var(--paper); color: var(--ink); width: calc(100vw - 1.5rem); margin: 0 0 1.5rem; padding: 8px; box-shadow: 0 2px 30px rgba(0, 0, 0, 0.2); align-self: start; }
  .band {
    height: 100%; padding: 10px; border: 2px solid var(--ink); background-color: var(--paper);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='16' viewBox='0 0 28 16'%3E%3Cg fill='none' stroke='%231c2030' stroke-width='0.7' opacity='0.55'%3E%3Cellipse cx='7' cy='8' rx='10' ry='6'/%3E%3Cellipse cx='21' cy='8' rx='10' ry='6'/%3E%3Cellipse cx='14' cy='8' rx='10' ry='6'/%3E%3Cellipse cx='0' cy='8' rx='10' ry='6'/%3E%3Cellipse cx='28' cy='8' rx='10' ry='6'/%3E%3C/g%3E%3C/svg%3E");
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .inner {
    height: 100%; background: var(--paper); border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: -5px;
    padding: 1.75rem 1rem 1.25rem; text-align: center;
    display: flex; flex-direction: column; justify-content: space-between; gap: 1.1rem;
  }
  .kicker { font-weight: 600; font-size: 0.72rem; letter-spacing: 0.3em; text-transform: uppercase; padding-left: 0.3em; }
  .kicker small { display: block; margin-top: 0.45em; font-weight: 400; font-size: 0.8em; color: var(--soft); }
  .mark { font: 400 2.3rem/1.05 Georgia, 'Times New Roman', serif; letter-spacing: 0.06em; padding-left: 0.06em; }
  .stdchar { font: italic 0.8rem/1.4 Georgia, 'Times New Roman', serif; color: var(--soft); margin-top: 0.6em; }
  .flourish { width: 9rem; margin: 0 auto; display: block; color: var(--ink); }

  .record { display: grid; grid-template-columns: 1fr 1fr; text-align: left; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
  .record div { padding: 0.4rem 0.6rem 0.5rem; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); min-width: 0; }
  .record .wide, .record .half { grid-column: 1 / -1; }
  .record span { display: block; font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); }
  .record strong { font: 400 0.85rem/1.35 Consolas, Monaco, 'Courier New', monospace; }
  .record .wide strong { font: 400 0.95rem/1.45 Georgia, 'Times New Roman', serif; }

  .foot { display: grid; justify-items: center; gap: 1rem; }
  .seal { width: 7.5rem; color: var(--seal); }
  .operated { font-size: 0.72rem; color: var(--soft); text-align: center; }
  .operated a { color: inherit; border-bottom: 1px dotted currentColor; text-decoration: none; }
  .sig { width: 15rem; max-width: 100%; text-align: center; }
  .sig .line { font: 1rem Consolas, Monaco, 'Courier New', monospace; padding-bottom: 0.3em; border-bottom: 1px solid var(--ink); }
  .sig .cap { margin-top: 0.4em; font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--soft); }
  .colophon { padding-top: 0.7em; border-top: 1px solid var(--rule); font-size: 0.7rem; line-height: 1.5; color: var(--soft); }
  .colophon a { color: var(--seal); }

  /* ---- the sheet: one object, scaled as a whole ---- */
  @media (min-width: 700px), print {
    .certificate-page .cert {
      width: min(calc(100vw - 2rem), calc((100dvh - 10.5rem) * var(--ratio)));
      aspect-ratio: var(--ratio); container-type: inline-size; padding: 1.1cqw; margin: 0;
    }
    .band { padding: 1.4cqw; border-width: 0.2cqw; background-size: 2.65cqw 1.5cqw; }
    .inner { padding: 2.9cqw 4.4cqw 1.7cqw; gap: 0; outline-offset: -0.55cqw; }
    .kicker { font-size: 1.25cqw; letter-spacing: 0.42em; padding-left: 0.42em; }
    .mark { font-size: 8.2cqw; letter-spacing: 0.08em; padding-left: 0.08em; }
    .stdchar { font-size: 1.22cqw; margin-top: 0.9cqw; }
    .flourish { width: 17cqw; }
    .record { grid-template-columns: repeat(4, 1fr); }
    .record div { padding: 0.45cqw 0.9cqw 0.55cqw; }
    .record .half { grid-column: span 2; }
    .record span { font-size: 0.95cqw; }
    .record strong { font-size: 1.28cqw; }
    .record .wide strong { font-size: 1.42cqw; }
    .foot { grid-template-columns: 1fr auto 1fr; align-items: end; justify-items: stretch; gap: 2cqw; text-align: left; }
    .seal { width: 12.5cqw; }
    .operated { font-size: 1.12cqw; }
    .sig { justify-self: end; width: 25cqw; }
    .sig .line { font-size: 1.6cqw; }
    .sig .cap { font-size: 0.95cqw; }
    .colophon { font-size: 1.12cqw; padding-top: 0.8cqw; }
  }

  @page { size: 11in 8.5in; margin: 0.4in; }
  @media print {
    html, body { background: #fff; min-height: 0; height: auto; display: block; }
    .nav { display: none; }
    /* Fills the printable width. The proportion is wider than the page, so the
       height always fits with room to spare, in either orientation. */
    .certificate-page .cert { width: 100%; box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  }

.certificate-page { display: grid; justify-items: center; align-content: start; gap: .5rem; min-height: 0; }
.certificate-actions { display: flex; gap: 1rem; padding: .4rem; }
.certificate-page .cert { line-height: normal; }
@media (min-width: 700px), print {
  .certificate-page .cert { font-size: 1.28cqw; padding: 0; }
  .certificate-page .band { margin: 1.1cqw; height: calc(100% - 2.2cqw); }
  .certificate-page .record div { font-size: 1.28cqw; }
}
@media (min-width: 700px) {
  .registration-page .clinic-shell { height: calc(100dvh - 1.5rem); min-height: 0; }
  .registration-page .below { height: 1.5rem; }
  .registration-page .shoes { width: 2.5rem; }
  .registration-page .note { display: none; }
  .registration-page .status { justify-content: center; }
  .registration-page .links { margin-left: 0; }
}
@media print { .bar, .status, .below, .certificate-actions { display: none !important; } .registration-page .clinic-shell { display: block; height: auto; min-height: 0; } .certificate-page { display: block; } }
