:root {
  --navy: var(--theme-primary, #001f4d);
  --ink: var(--theme-border, #000000);
  --page-bg: var(--theme-bg, #f3f4f6);
  --muted: #52606d;
  --text-color: var(--theme-text, #001f4d);
}

@page {
  size: A4;
  margin: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
  font-family: "Baskerville", "Palatino Linotype", "Book Antiqua", serif;
  color: var(--text-color);
}

.page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 12mm 15mm;
  background: var(--page-bg);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 0 1px rgba(0, 31, 77, 0.12), 0 12px 30px rgba(0, 0, 0, 0.08);
}

.page::before {
  content: "";
  position: absolute;
  inset: 6mm;
  border: 4px solid var(--navy);
  border-radius: 10px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.header {
  text-align: center;
  margin-bottom: 6px;
  padding-top: 4mm;
}

.logo {
  width: 92px;
  height: auto;
  margin-bottom: 10px;
}

.school-name {
  margin: 0;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  line-height: 1.16;
  font-family: "Baskerville", "Palatino Linotype", "Book Antiqua", serif;
  text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.15);
}

.motto {
  margin: 6px 0 10px;
  font-size: 20px;
  font-style: italic;
  color: var(--navy);
  font-weight: 700;
}

.header::after {
  content: "";
  display: block;
  width: 100%;
  height: 2.5px;
  background: var(--navy);
  margin: 8px 0 12px;
  border-radius: 2px;
}

.badge {
  display: inline-block;
  background: linear-gradient(90deg, var(--navy), var(--theme-accent, #002b63));
  color: white;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  padding: 12px 22px;
  margin: 4px 0 12px;
  box-shadow: 0 3px 8px rgba(0, 31, 77, 0.18);
  font-size: 15px;
}

.details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 8px;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 0;
}

.value {
  width: 100%;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.3px;
}

.value-form,
.value-paper {
  font-size: 20px;
}

.value-subject {
  font-size: 35px;
}

.logistics-grid {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 5px;
  margin: 5px 0 6px;
}

.logistics-grid .grid-box:last-child {
  margin-left: auto;
}

.grid-box {
  padding: 5px 6px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.grid-title {
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.6px;
}

.grid-value {
  font-size: 20px;
  font-weight: 700;
}

.candidate-box {
  border: 3px solid var(--ink);
  padding: 5px 5px;
  font-size: 15px;
  font-weight: 700;
  margin: 3px 0 6px;
  background: #fcfcfd;
  width: 100%;
  max-width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
}

.instructions {
  border: 1.5px solid var(--navy);
  padding: 0;
  margin-top: 4px;
  overflow: hidden;
  min-height: 180px;
  width: 100%;
}

.instructions h2 {
  margin: 0;
  background: var(--navy);
  color: white;
  font-size: 15px;
  text-transform: uppercase;
  padding: 10px 14px;
  letter-spacing: 0.8px;
  font-weight: 900;
}

.instructions ul {
  margin: 7px 0 7px 5px;
  padding-right: 7px;
}

.instructions li {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  line-height: 1.3;
}

.footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 31, 77, 0.18);
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.footer-copy {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.footer-quote {
  font-style: italic;
  margin-top: 2px;
}

@media print {
  html, body {
    width: 210mm;
    height: 297mm;
    margin: 0;
    padding: 0;
    background: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    display: block;
  }

  .page {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 10mm 12mm;
    box-shadow: none;
    page-break-after: avoid;
    align-items: flex-start;
  }

  .content {
    gap: 10px;
  }
}
