* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #e8ece8; font-family: Arial, Helvetica, sans-serif; color: #222; }
.certificate-toolbar { width: min(210mm, calc(100% - 24px)); margin: 12px auto; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.certificate-toolbar a { color: #3f4d40; }
.certificate-toolbar button { border: 0; border-radius: 8px; padding: 10px 14px; background: #546353; color: white; font-weight: 700; cursor: pointer; }
.certificate-page { position: relative; width: 210mm; height: 297mm; margin: 0 auto 24px; overflow: hidden; background: white; box-shadow: 0 8px 30px rgba(0,0,0,.14); }
.certificate-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.certificate-page > div:not(.certificate-bg) { position: absolute; z-index: 2; }

.giro-name { left: 15mm; right: 15mm; top: 250mm; text-align: center; font-size: 20pt; font-weight: 800; }
.giro-data { left: 48mm; right: 15mm; top: 268mm; display: grid; grid-template-columns: 45mm 50mm 50mm; font-size: 18pt; font-weight: 800; }

.imst-legacy-data { left: 34mm; right: 15mm; top: 242mm; display: grid; grid-template-columns: 107mm 1fr; gap: 0; font-size: 18pt; font-weight: 800; color: #3c3c3b; }
.layout-imst-legacy .person { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.imst-modern-heading { right: 7mm; top: 40mm; text-align: right; color: white; display: grid; gap: 2mm; }
.imst-modern-heading strong { font-size: 34pt; max-width: 140mm; line-height: .95; }
.imst-modern-heading span { font-size: 24pt; font-weight: 800; }
.imst-modern-info { left: 12mm; right: 10mm; top: 218mm; display: grid; gap: 1mm; color: #3c3c3b; font-size: 17pt; }
.imst-modern-person { left: 12mm; right: 12mm; top: 251mm; display: grid; grid-template-columns: 1fr auto; gap: 10mm; color: #3c3c3b; font-size: 17pt; }

.imst24-top { left: 12mm; top: 5mm; display: grid; gap: 4mm; color: #1d1d1b; }
.imst24-top strong:first-child { font-size: 70pt; line-height: .85; }
.imst24-top span { font-size: 19pt; }
.imst24-top em { color: #dd0714; font-size: 19pt; font-style: normal; font-weight: 700; }
.imst24-top strong:last-child { font-size: 82pt; line-height: .85; margin-top: 3mm; }
.imst24-data { left: 12mm; right: 12mm; top: 207mm; display: grid; gap: 3mm; font-size: 18pt; }
.imst24-data label { color: #1d1d1b; font-weight: 700; }
.imst24-data b { color: #dd076f; margin-bottom: 3mm; }

@page { size: A4 portrait; margin: 0; }
@media print {
    html, body { width: 210mm; height: 297mm; background: white; }
    .no-print { display: none !important; }
    .certificate-page { margin: 0; box-shadow: none; page-break-after: avoid; }
}

@media screen and (max-width: 820px) {
    .certificate-page { transform-origin: top left; width: 210mm; height: 297mm; }
    body { overflow-x: auto; }
}
