*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Times New Roman', Times, serif; font-size: 12pt; background: #e0e0e0; color: #000; }

/* A4 PORTRAIT */
.page {
  width: 210mm;
  margin: 20px auto;
  background: #fff;
  padding: 15mm 20mm 15mm 25mm;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.nomor-dok { font-size: 8pt; color: #444; text-align: right; margin-bottom: 4px; }

.doc-header {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 8px;
  border-top: none;
  border-bottom: 3px solid #1a365d;
  padding: 7px 0;
  margin-bottom: 12px;
}
.logo-box {
  width: 48px; height: 48px;
  border: 1.5px dashed #555;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 6.5pt; color: #555; text-align: center; line-height: 1.3;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-box.has-logo {
  border: none;
}
.doc-title-center { text-align: center; }
.doc-title-center .instansi { font-size: 9.5pt; font-weight: normal; }
.doc-title-center .judul-utama { font-size: 14pt; font-weight: bold; text-transform: uppercase; letter-spacing: 0.05em; margin: 2px 0; }
.doc-title-center .subjudul { font-size: 9.5pt; }

/* IDENTITAS — 2 kolom stacked label+value (Portrait) */
.identitas { width: 100%; border-collapse: collapse; margin-bottom: 10px; font-size: 10pt; table-layout: fixed; }
.identitas td { padding: 5px 6px; border: 1px solid #1a365d; vertical-align: middle; }
.identitas .id-label { display: block; font-size: 9pt; font-weight: 600; color: #555; margin-bottom: 1px; line-height: 1.3; }
.identitas .id-value { display: block; font-size: 11pt; font-weight: 700; color: #000; line-height: 1.3; }

.page .section-title {
  font-size: 10.5pt; font-weight: bold; text-transform: uppercase;
  letter-spacing: 0.04em;  border-left: 4px solid #1a365d;
  padding: 3px 8px; margin: 6px 0; background: #f5f5f5;
  color: #000;
}

/* ══ LEVEL CARD — Section A ══ */
.level-card {
  border: 1px solid #1a365d;
  border-radius: 4px;
  margin-bottom: 8px;
  overflow: hidden;
}
.level-card-header {
  background: #1a365d;
  color: #fff;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5pt;
  font-weight: bold;
  letter-spacing: 0.02em;
}
.level-card-header .card-range {
  font-size: 8.5pt;
  font-weight: 600;
  opacity: 0.9;
}
.level-card-header.level-layak {
  background: #155724;
}
.level-card-body {
  padding: 6px 10px;
  font-size: 9pt;
  line-height: 1.5;
}
.level-card-body .card-desc {
  margin-bottom: 4px;
}
.level-card-body .card-action-label {
  font-weight: bold;
  font-size: 8.5pt;
  color: #333;
  margin-bottom: 2px;
}
.level-card-body .card-action {
  font-size: 8.5pt;
  color: #444;
  white-space: pre-line;
}

/* ═══ CARD LAYOUT — Section B Rubrik (Portrait) ═══ */
.kktp-elemen-group {
  margin-bottom: 12px;
}
.kktp-elemen-title {
  font-size: 9.5pt;
  font-weight: bold;
  color: #1a365d;
  background: #edf5ff;
  border: 1px solid #b0c4de;
  border-bottom: 2px solid #1a365d;
  padding: 5px 10px;
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}
.kktp-card {
  border: 1px solid #1a365d;
  border-radius: 4px;
  margin-bottom: 10px;
  overflow: hidden;
}
.kktp-card-header {
  background: #1a365d;
  color: #fff;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 9pt;
  font-weight: bold;
}
.kktp-card-header .card-no {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 8pt;
}
.kktp-card-header .card-kode {
  font-family: 'Courier New', monospace;
  font-size: 8.5pt;
  letter-spacing: 0.02em;
}
.kktp-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
  border-bottom: 1px solid #1a365d;
}
.kktp-info-table td {
  padding: 4px 8px;
  border: 1px solid #ccc;
  vertical-align: top;
  line-height: 1.5;
}
.kktp-info-table td.info-label {
  font-weight: bold;
  width: 22%;
  background: #f8f9fa;
  color: #333;
  white-space: nowrap;
}
.kktp-level-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
}
.kktp-level-table td {
  padding: 4px 8px;
  border: 1px solid #ccc;
  vertical-align: top;
  line-height: 1.45;
}
.kktp-level-table td.level-name {
  font-weight: bold;
  width: 22%;
  background: #f8f9fa;
  white-space: nowrap;
}
.kktp-level-table td.level-name.level-layak {
  background: #d4edda;
  color: #155724;
}
.kktp-level-table tr:nth-child(even) td {
  background: #fafafa;
}
.kktp-level-table tr:nth-child(even) td.level-layak {
  background: #d4edda;
}

/* Legacy table.kktp — backward compat */
table.kktp {
  width: 100%; border-collapse: collapse; font-size: 7.5pt; margin-bottom: 10px;
  table-layout: fixed;
}
table.kktp th {
  background: #1a365d; color: #ffffff;
  padding: 4px 3px; border: 1px solid #1a365d;
  text-align: center; vertical-align: middle; line-height: 1.3;
  border-bottom: 2px solid #1a365d;
}
table.kktp td {
  padding: 4px 3px; border: 1px solid #1a365d;
  vertical-align: top; line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
table.kktp tr:nth-child(even) td { background: #fafafa; }
table.kktp td.no { text-align: center; font-weight: bold; width: 20px; vertical-align: middle; }
table.kktp td.kode {
  font-family: 'Courier New', monospace; font-size: 8pt;
  font-weight: bold; text-align: center; vertical-align: middle; width: 80px;
}
table.kktp td.center { text-align: center; vertical-align: middle; }
table.kktp tr.elemen-header td {
  background: #edf5ff; color: #1a365d;
  font-weight: bold; font-size: 9pt; padding: 4px 7px;
  letter-spacing: 0.03em;
  border-bottom: 2px solid #1a365d;
}
table.kktp td.col-mb    { border-left: 2px solid #1a365d; background: #fff; }
table.kktp td.col-layak { border-left: 2px solid #1a365d; background: #fafafa; }
table.kktp td.col-cakap { border-left: 2px solid #1a365d; background: #fff; }
table.kktp td.col-mahir { border-left: 2px solid #1a365d; background: #fafafa; }
table.kktp tr:nth-child(even) td.col-mb    { background: #f0f0f0; }
table.kktp tr:nth-child(even) td.col-layak { background: #f5f5f5; }
table.kktp tr:nth-child(even) td.col-cakap { background: #f0f0f0; }
table.kktp tr:nth-child(even) td.col-mahir { background: #f5f5f5; }

/* KONVERSI */
table.konversi {
  width: 55%; border-collapse: collapse; table-layout: fixed; font-size: 9.5pt; margin-bottom: 10px;
}
table.konversi th {
  background: #1a365d; color: #ffffff;
  padding: 5px 10px; border: 1px solid #1a365d; text-align: center;
  border-bottom: 2px solid #1a365d;
}
table.konversi td {
  padding: 4px 10px; border: 1px solid #1a365d;
  text-align: center; vertical-align: middle;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
table.konversi tr:nth-child(even) td { background: #fafafa; }

.catatan {
  font-size: 8pt; color: #333; margin-bottom: 10px;
  padding: 5px 8px; border-left: 3px solid #555;
  line-height: 1.7; background: #fafafa;
  border-top: 1px solid #ccc; border-bottom: 1px solid #ccc;
  margin-top: 4mm;
  max-width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.doc-footer {
  border-top: 2px solid #000; margin-top: 12px; padding-top: 4px;
  display: flex; justify-content: space-between; font-size: 8pt; color: #333;
}

/* PAGE BREAK */
.page-break { page-break-before: always; }

/* Ensure table headers repeat on each page */
thead {
  display: table-header-group !important;
}
tfoot {
  display: table-footer-group !important;
}

.kop-pemda {
    font-size: 8pt;
    font-weight: normal;
    letter-spacing: 0.04em;
    margin-bottom: 1px;
  }
  .kop-dinas {
    font-size: 9pt;
    font-weight: bold;
    letter-spacing: 0.03em;
    margin-bottom: 1px;
  }
  .kop-sekolah {
    font-size: 12pt;
    font-weight: bold;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
  }
  .kop-alamat {
    font-size: 7.5pt;
    font-weight: normal;
    font-style: italic;
    letter-spacing: 0.01em;
  }
  .doc-title-center {
    text-align: center;
    line-height: 1.25;
  }
  .doc-judul-area {
    text-align: center;
    margin-bottom: 12px;
  }
  .doc-judul-area .judul-utama {
    font-size: 14pt;
    font-weight: bold;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 4px 0 2px 0;
  }
  .doc-judul-area .subjudul {
    font-size: 10pt;
    color: #444;
  }
  .ttd-wrapper {
    margin-top: 20px;
  }

/* ── Area TTD Pengesahan ── */
.ttd-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
}
.ttd-box {
  text-align: center;
  font-size: 10pt;
  padding: 8px 12px;
}
.ttd-box .ttd-jabatan {
  font-weight: bold;
  color: #1a365d;
  font-size: 9.5pt;
  margin-bottom: 4px;
}
.ttd-box .ttd-tanggal {
  font-size: 9.5pt;
  margin-bottom: 44px;
}
.ttd-box .ttd-nama {
  font-weight: bold;
  font-size: 10pt;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ttd-box .ttd-nip {
  font-size: 9pt;
  color: #333;
  margin-top: 3px;
}

@media print {
  @page { margin: 15mm; }
  body { background: #fff; }
  .page {
    margin: 0;
    box-shadow: none;
    padding: 0 !important;
  }
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
