.identitas-app .topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

body.print-mode .main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

body.print-mode .identitas-hide-print {
  display: none !important;
}

body.print-mode .topbar {
  order: 2;
  justify-content: flex-start;
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

body.print-mode #panel-pilih-murid {
  order: 1;
  max-width: 640px;
}

body.print-mode #panel-pilih-murid .form-grid {
  margin-bottom: 1rem;
}

body.print-mode .topbar-actions {
  width: 100%;
  max-width: 640px;
  justify-content: flex-start;
  margin-bottom: 0.5rem;
}

.btn-outline.sm { padding: 6px 12px; font-size: 13px; margin-top: 8px; }
.siswa-search-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.siswa-search-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--border, #e8dcc8);
  border-radius: 8px;
  font: inherit;
}
.siswa-search-row input:focus {
  outline: none;
  border-color: var(--primary, #a67c52);
  box-shadow: 0 0 0 3px rgba(166, 124, 82, 0.15);
}
.siswa-search-row .btn-outline {
  flex-shrink: 0;
  white-space: nowrap;
}
.form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: var(--text-muted, #7a6654); }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--border, #e8dcc8);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--text, #3d2e1f);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary, #a67c52);
  box-shadow: 0 0 0 3px rgba(166, 124, 82, 0.15);
}
.sub-title { margin: 18px 0 8px; font-size: 15px; }
.alert { margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.alert.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert.hidden { display: none; }

.siswa-preview-panel {
  padding-top: 0.5rem;
}

.siswa-preview-card {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  max-width: 760px;
}

.siswa-preview-photo {
  flex: none;
  width: 92px;
  height: 118px;
  border-radius: 10px;
  border: 1px solid var(--border, #e8dcc8);
  background: var(--primary-light, #f5ebe0);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.siswa-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.siswa-preview-photo-none {
  color: #cbd5e1;
  font-size: 1.4rem;
}

.siswa-preview-body h2 {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  line-height: 1.3;
}

.siswa-preview-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 1.25rem;
  margin: 0 0 0.85rem;
}

.siswa-preview-meta div {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 0.35rem;
  font-size: 0.84rem;
}

.siswa-preview-meta dt {
  margin: 0;
  color: #64748b;
  font-weight: 600;
}

.siswa-preview-meta dd {
  margin: 0;
  color: #0f172a;
}

@media (max-width: 640px) {
  .siswa-preview-card {
    flex-direction: column;
    max-width: 100%;
    gap: 0.85rem;
  }

  .siswa-preview-body {
    min-width: 0;
    width: 100%;
  }

  .siswa-preview-body h2 {
    font-size: 1.05rem;
    word-break: break-word;
  }

  .siswa-preview-meta {
    grid-template-columns: 1fr;
  }

  .siswa-preview-meta div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .siswa-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .siswa-search-row .btn-outline {
    width: 100%;
    white-space: normal;
  }

  .field select,
  .field input {
    max-width: 100%;
    box-sizing: border-box;
  }

  #section-catatan h2 {
    font-size: 1rem;
    line-height: 1.35;
    word-break: break-word;
  }
}

#section-catatan .sub-title-catatan {
  font-size: 16px;
}

.catatan-meta {
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border, #e8dcc8);
}

.catatan-meta-table {
  width: 100%;
  border-collapse: collapse;
}

.catatan-meta-table td {
  width: 50%;
  vertical-align: top;
  padding: 0 8px 0 0;
}

.catatan-meta-row {
  display: grid;
  grid-template-columns: 90px 12px 1fr;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 14px;
}

.catatan-meta-row .label {
  font-weight: 600;
  color: #334155;
}

.catatan-meta-row .sep {
  color: #64748b;
}

.import-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.import-filename { margin-top: 10px; font-size: 13px; color: #64748b; }
.file-btn { cursor: pointer; display: inline-flex; align-items: center; }
.file-btn input { display: none; }

.template-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.template-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 1100px;
}

.tpl-row-nama {
  grid-template-columns: 28px 200px minmax(520px, 1fr);
}

.tpl-input-nama {
  min-width: 520px;
  max-width: 100%;
}

.tpl-input-alamat-wali {
  min-width: 520px;
  min-height: 88px;
  max-width: 100%;
  resize: vertical;
}

.tpl-row,
.tpl-sub {
  display: grid;
  grid-template-columns: 28px 200px 1fr;
  gap: 10px;
  align-items: start;
}

.tpl-row-2 {
  grid-template-columns: 28px 200px 1fr 28px 160px 120px;
}

.tpl-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.tpl-sub {
  grid-template-columns: 48px 152px 1fr;
  padding-left: 28px;
}

.tpl-no {
  font-weight: 700;
  color: #334155;
  padding-top: 10px;
}

.tpl-label,
.tpl-sub-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  padding-top: 10px;
}

.tpl-input {
  width: 100%;
  border: 1.5px solid var(--border, #e8dcc8);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

.tpl-input.readonly {
  background: #f8fafc;
  color: #475569;
}

.tpl-inline {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 8px;
}

.tpl-short {
  max-width: 180px;
}

@media (max-width: 768px) {
  .tpl-row,
  .tpl-sub,
  .tpl-row-2 {
    grid-template-columns: 1fr;
  }

  .tpl-sub { padding-left: 0; }
  .tpl-no, .tpl-label, .tpl-sub-label { padding-top: 0; }
  .tpl-inline { grid-template-columns: 1fr; }
  .tpl-short { max-width: none; }
  .tpl-input-nama { min-width: 0; }
  .tpl-input-alamat-wali { min-width: 0; min-height: 72px; }
  .tpl-row-nama { grid-template-columns: 1fr; }
}

/* Perbesar area input tabel agar teks panjang tetap terlihat */
#tbl-prestasi td input,
#tbl-prestasi td select,
#tbl-catatan td input,
#tbl-catatan td select,
#tbl-catatan-lain td input:not(.date-ddmmyyyy-picker) {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1.5px solid var(--border, #e8dcc8);
  border-radius: 8px;
  font: inherit;
  box-sizing: border-box;
}

#tbl-catatan td .c-catatan,
#tbl-catatan-lain td .cl-keterangan {
  min-width: 360px;
}

#tbl-catatan-lain td .date-ddmmyyyy > input[type="text"].cl-tanggal {
  padding-right: 2.5rem;
}

#tbl-prestasi td .select-lainnya-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

#tbl-prestasi td .p-tingkat-lain,
#tbl-prestasi td .p-juara-lain {
  min-width: 140px;
}

#tbl-prestasi td .p-tingkat {
  min-width: 140px;
}

#tbl-prestasi td .p-juara {
  min-width: 170px;
}

#tbl-prestasi td .p-kegiatan {
  min-width: 240px;
}

@media (max-width: 768px) {
  .form-grid.two-col { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .identitas-app .topbar {
    align-items: stretch;
  }

  .identitas-app .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .identitas-app .topbar-actions .btn-outline,
  .identitas-app .topbar-actions .btn-primary {
    width: 100%;
    padding: 0.65rem 0.5rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 560px) {
  .identitas-app .topbar-actions {
    grid-template-columns: 1fr;
  }

  #tbl-catatan td .c-catatan,
  #tbl-catatan-lain td .cl-keterangan {
    min-width: 0;
  }

  #tbl-prestasi td .p-kegiatan {
    min-width: 0;
  }
}

.identitas-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.72);
  padding: 0;
}

.identitas-preview-modal.hidden {
  display: none !important;
}

.identitas-preview-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #1e293b;
  color: #fff;
  flex-shrink: 0;
}

.identitas-preview-modal-bar strong {
  font-size: 0.92rem;
}

.jurnal-preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.jurnal-preview-actions .btn-outline {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  background: transparent;
}

.jurnal-preview-actions .btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.7);
}

#btn-jurnal-preview-print,
#btn-kegiatan-preview-print,
.btn-preview-print {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

#btn-jurnal-preview-print:hover,
#btn-kegiatan-preview-print:hover,
.btn-preview-print:hover {
  background: #4338ca;
  border-color: #4338ca;
}

.identitas-preview-modal iframe {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: calc(100dvh - 52px);
  border: 0;
  background: #525659;
  /* Biarkan dokumen di dalam iframe digeser penuh (vertikal + horizontal) */
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .identitas-preview-modal {
    padding: 0;
    /* Modal penuh layar: konten scroll di dalam iframe */
    overflow: hidden;
  }
  .identitas-preview-modal-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
  }
  .identitas-preview-modal-bar strong {
    flex: 1 1 100%;
    font-size: 0.85rem;
  }
  .jurnal-preview-actions {
    width: 100%;
    justify-content: stretch;
  }
  .jurnal-preview-actions .btn-outline {
    flex: 1 1 auto;
  }
  .identitas-preview-modal iframe {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    background: #e8eaed;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .buku-album-toolbar {
    width: 100%;
  }
  .buku-album-toolbar .field {
    min-width: 0;
    flex: 1 1 140px;
  }
  .buku-album-kenangan-preview {
    width: 160px;
    max-width: 160px;
    height: 90px;
  }
  .buku-album-ornamen-preview {
    width: 96px;
    max-width: 96px;
    height: 96px;
  }
  .buku-album-grid {
    grid-template-columns: 1fr;
  }
  .buku-album-card-top {
    flex-direction: column;
  }
  .buku-album-card-photo,
  .buku-album-card-photo.ph {
    width: 96px;
    height: 124px;
  }
}

.identitas-app .sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
}

/* Mode embed di dalam index.html — sidebar induk yang dipakai */
html.identitas-embed .sidebar,
html.identitas-embed .sidebar-overlay,
html.identitas-embed .sidebar-toggle {
  display: none !important;
}

html.identitas-embed .main {
  margin-left: 0 !important;
  width: 100%;
  max-width: none;
  padding: 0.75rem 1rem 1.25rem;
}

html.identitas-embed body {
  background: #fffaf5;
}

html.identitas-embed .topbar-titles,
html.identitas-embed .brand-link {
  display: none !important;
}

html.identitas-embed .topbar {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
