.certificate-panel { margin: 16px auto; max-width: 640px; }
.certificate-panel h3 { margin: 0 0 8px; }
.certificate-panel label { display: block; margin-bottom: 4px; }
.certificate-panel input {
  width: min(100%, 320px);
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid #a283bd;
  border-radius: 12px;
  font: inherit;
}
#matchingCertificate { display: block; width: 100%; height: auto; margin: 12px auto; }
.certificate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
@media print {
  @page { size: landscape; margin: 10mm; }
  body:has(#complete:not([hidden]) > .certificate-panel) { background: white; }
  body:has(#complete:not([hidden]) > .certificate-panel) > :not(main),
  main:has(#complete:not([hidden]) > .certificate-panel) > :not(#complete),
  #complete:not([hidden]) > :not(.certificate-panel),
  .certificate-panel > :not(svg) { display: none !important; }
  main:has(#complete:not([hidden]) > .certificate-panel), #complete:has(> .certificate-panel), .certificate-panel {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: white;
    box-shadow: none;
  }
  #matchingCertificate {
    width: 100%;
    max-height: 165mm;
    margin: 0 auto;
    break-inside: avoid;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
.unit-certificate-button, .unit-certificate-close {
  display: block;
  margin: 10px auto;
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid #a283bd;
  border-radius: 12px;
  background: #f6ebff;
  color: #34204e;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.unit-certificate-dialog {
  box-sizing: border-box;
  width: min(680px, calc(100% - 24px));
  max-height: 90dvh;
  padding: 14px;
  border: 2px solid #a283bd;
  border-radius: 20px;
  background: #fffdfa;
  color: #34204e;
  text-align: center;
}
.unit-certificate-dialog::backdrop { background: #261637aa; }
.unit-certificate-dialog .certificate-actions button {
  min-height: 44px;
  padding: 8px 14px;
}
@media print {
  body:has(> .unit-certificate-dialog[open]) > :not(.unit-certificate-dialog),
  .unit-certificate-dialog[open] > :not(.certificate-panel) { display: none !important; }
  .unit-certificate-dialog[open] {
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: white;
  }
  .unit-certificate-dialog::backdrop { display: none; }
}
