/* ==========================================================================
   Administrasi Rapat Sekolah - UI & Official Document Design System
   Mengikuti standar visual & tata naskah dinas aplikasi e-SPPD SMKN 1 Punggelan
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  --accent-50: #fffbeb;
  --accent-500: #f59e0b;
  --accent-600: #d97706;

  --success-50: #ecfdf5;
  --success-600: #059669;
  --danger-50: #fef2f2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;

  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.06);
  --shadow-paper: 0 8px 24px -4px rgba(15, 23, 42, 0.14), 0 2px 6px -1px rgba(15, 23, 42, 0.08);

  --header-height: 68px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: #f1f5f9;
  color: var(--slate-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-900);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title-mobile { display: none; }

.brand-text p {
  font-size: 0.78rem;
  color: var(--slate-500);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease-in-out;
  text-decoration: none;
  white-space: nowrap;
}

.btn-icon-only { padding: 8px; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--slate-300);
  color: var(--slate-700);
}
.btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
  color: var(--slate-900);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-600), #047857);
  color: #ffffff;
}
.btn-success:hover { filter: brightness(1.08); }

.btn-danger-outline {
  background: transparent;
  border-color: #fecaca;
  color: var(--danger-600);
}
.btn-danger-outline:hover {
  background: var(--danger-50);
  border-color: var(--danger-500);
}

.btn-ghost {
  background: transparent;
  color: var(--slate-600);
}
.btn-ghost:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}

.btn-sm {
  font-size: 0.77rem;
  padding: 5px 10px;
}

.preset-btn {
  background: #ffffff;
  border: 1px solid var(--slate-300);
  color: var(--slate-700);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.preset-btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
  color: var(--primary-700);
  transform: translateY(-1px);
}

.suggestion-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate-600);
}

.input-nomor-highlight {
  font-family: monospace;
  font-size: 0.9rem;
  font-weight: 700;
  background: #ffffff;
  color: var(--primary-900);
}

.input-readonly-highlight {
  background: var(--slate-100);
  font-weight: 700;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  background: var(--slate-100);
  color: var(--primary-800);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ── Main Split Layout ── */
.app-container {
  display: grid;
  grid-template-columns: 540px 1fr;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

@media screen and (min-width: 1440px) {
  .app-container {
    grid-template-columns: 580px 1fr;
  }
}

.form-panel {
  background: #f8fafc;
  border-right: 1px solid var(--slate-200);
  height: 100%;
  overflow-y: auto;
  padding: 22px 20px 80px 20px;
}

.preview-panel {
  background: #e2e8f0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-toolbar {
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.template-tabs {
  display: flex;
  background: var(--slate-100);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
  flex-wrap: wrap;
}

.tab-btn {
  font-family: var(--font-sans);
  font-size: 0.79rem;
  font-weight: 600;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--slate-600);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary-700);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

/* Page Navigation Bar (Per Pages Preview) */
.preview-page-bar {
  background: #f8fafc;
  border-bottom: 1px solid var(--slate-200);
  padding: 7px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  flex-shrink: 0;
}

.page-bar-summary {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--slate-600);
  white-space: nowrap;
  padding-right: 6px;
  border-right: 1px solid var(--slate-300);
}

.page-pill {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--slate-300);
  background: #ffffff;
  color: var(--slate-700);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.page-pill:hover, .page-pill.active {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: #ffffff;
}

.preview-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 26px 30px 48px 30px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: radial-gradient(circle at center, #cbd5e1 0%, #94a3b8 100%);
}

#document-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-sheet-label {
  align-self: flex-start;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e293b;
  background: rgba(255, 255, 255, 0.88);
  padding: 3px 12px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ── Form Cards ── */
.form-header-card {
  background: linear-gradient(135deg, var(--primary-900), #1e293b);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.form-header-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #fbbf24);
}
.form-header-card h2 { font-size: 1.12rem; font-weight: 700; margin-bottom: 4px; }
.form-header-card p { font-size: 0.81rem; color: var(--slate-300); }

.form-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-card:focus-within {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), var(--shadow-md);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--slate-100);
  gap: 8px;
}

.card-title-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary-800);
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-title { font-size: 0.94rem; font-weight: 700; color: var(--slate-900); }
.card-subtitle { font-size: 0.75rem; color: var(--slate-500); margin-top: 2px; }

.form-group { margin-bottom: 13px; }
.form-group:last-child { margin-bottom: 0; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-label {
  display: block;
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 5px;
}
.form-label .required { color: var(--danger-600); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 9px 12px;
  color: var(--slate-800);
  background: #ffffff;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-textarea { resize: vertical; min-height: 66px; }
.input-hint { font-size: 0.74rem; color: var(--slate-500); margin-top: 4px; }

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--slate-700);
  cursor: pointer;
}

/* ── Autocomplete ── */
.autocomplete-wrapper { position: relative; }

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  max-height: 250px;
  overflow-y: auto;
  z-index: 60;
  display: none;
}
.autocomplete-dropdown.show { display: block; }

.autocomplete-item {
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--slate-100);
  transition: background 0.12s;
}
.autocomplete-item:hover, .autocomplete-item.active {
  background: var(--primary-50);
}

.item-left { display: flex; flex-direction: column; min-width: 0; }
.item-name { font-size: 0.85rem; font-weight: 700; color: var(--slate-800); }
.item-nip { font-size: 0.74rem; color: var(--slate-500); }
.item-badge {
  font-size: 0.69rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--slate-100);
  color: var(--slate-700);
  white-space: nowrap;
}

/* ── Peserta List ── */
.peserta-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.peserta-count-badge {
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-200);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.peserta-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 2px;
}

.peserta-item-card {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.peserta-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.peserta-item-num {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--primary-700);
  background: var(--primary-100);
  padding: 2px 8px;
  border-radius: 999px;
}

.peserta-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-mini-icon {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  color: var(--slate-600);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
}
.btn-mini-icon:hover { background: var(--slate-100); color: var(--slate-900); }
.btn-mini-icon.danger:hover { background: var(--danger-50); border-color: #fecaca; color: var(--danger-600); }

.peserta-fields-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 6px;
}

.peserta-fields-grid .form-input {
  padding: 6px 8px;
  font-size: 0.79rem;
}

.peserta-empty-box {
  text-align: center;
  padding: 18px;
  background: var(--slate-50);
  border: 1px dashed var(--slate-300);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--slate-500);
}

.signer-choice-box {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--slate-50);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
}

.signer-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 500;
}

.alert-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
}
.alert-info {
  background: var(--primary-50);
  color: var(--primary-900);
  border: 1px solid var(--primary-200);
}

/* ==========================================================================
   Official Document Sheet (Paper Style)
   ========================================================================== */
.document-sheet {
  background: #ffffff;
  color: #000000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11pt;
  line-height: 1.35;
  padding: 1.4cm 1.5cm 1.4cm 2.0cm;
  box-shadow: var(--shadow-paper);
  border-radius: 2px;
  position: relative;
  margin-bottom: 28px;
  box-sizing: border-box;
  overflow: hidden;
}

body.paper-f4 .document-sheet,
.page-f4 {
  width: 215mm;
  height: 330mm;
  min-height: 330mm;
  max-height: 330mm;
}

body.paper-a4 .document-sheet,
.page-a4 {
  width: 210mm;
  height: 297mm;
  min-height: 297mm;
  max-height: 297mm;
}

.sheet-inner {
  width: 100%;
  height: auto;
  box-sizing: border-box;
  transform-origin: top left;
}

/* Kop Surat Resmi (2 Logo) */
.official-kop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.kop-logo-left {
  width: 90px;
  height: 100px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kop-logo-right {
  width: 98px;
  height: 104px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kop-logo-img {
  height: 96px;
  max-height: 96px;
  max-width: 90px;
  width: auto;
  object-fit: contain;
  display: block;
}

.kop-logo-img.kop-logo-school {
  height: 104px;
  max-height: 104px;
  max-width: 96px;
}

.kop-text-wrapper {
  flex: 1;
  text-align: center;
  padding: 0 2px;
}

.kop-instansi {
  font-size: 11.5pt;
  font-weight: normal;
  letter-spacing: 0.2px;
  margin: 0;
  line-height: 1.25;
  text-transform: uppercase;
  color: #000000;
}

.kop-dinas {
  font-size: 13.5pt;
  font-weight: bold;
  letter-spacing: 0.3px;
  margin: 1px 0 0 0;
  line-height: 1.25;
  text-transform: uppercase;
  color: #000000;
}

.kop-sekolah-l1, .kop-sekolah-l2 {
  font-size: 14.5pt;
  font-weight: bold;
  letter-spacing: 0.4px;
  margin: 0;
  line-height: 1.2;
  text-transform: uppercase;
  color: #000000;
}

.kop-alamat, .kop-kontak, .kop-email {
  font-size: 8.2pt;
  margin: 2px 0 0 0;
  line-height: 1.25;
  color: #000000;
}

.kop-link {
  color: #0563c1 !important;
  text-decoration: underline !important;
}

.kop-divider {
  border-top: 3.5px solid #000000;
  border-bottom: 1px solid #000000;
  height: 2px;
  margin: 4px 0 12px 0;
  box-sizing: content-box;
}

/* Document Elements */
.doc-header-title {
  text-align: center;
  margin-bottom: 10px;
}
.doc-header-title .title-main {
  font-size: 13pt;
  font-weight: bold;
  text-decoration: underline;
  margin: 0;
  letter-spacing: 0.5px;
}

.table-borderless {
  width: 100%;
  border-collapse: collapse;
}
.table-borderless td {
  padding: 2px 0;
  vertical-align: top;
  font-size: 11pt;
}

.table-official-grid {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
}
.table-official-grid th, .table-official-grid td {
  border: 1px solid #000000;
  padding: 4px 6px;
  vertical-align: top;
  font-size: 10pt;
}
.table-official-grid th {
  background-color: #f1f5f9;
  font-weight: bold;
  text-align: center;
}

/* Undangan Layout */
.undangan-meta-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
}
.undangan-meta-left { flex: 1; }
.undangan-meta-right { width: 42%; font-size: 11pt; line-height: 1.38; }

.undangan-body {
  font-size: 11pt;
  line-height: 1.45;
}
.undangan-salutation { margin-bottom: 8px; }
.undangan-intro { margin-bottom: 10px; text-align: justify; text-indent: 28px; }
.undangan-detail-table {
  margin: 6px 0 12px 28px;
  width: calc(100% - 28px);
}
.undangan-detail-table td { padding: 3px 0; }
.undangan-catatan-box {
  margin: 8px 0 10px 0;
  padding: 6px 10px;
  border-left: 3px solid #000000;
  background: #f8fafc;
  font-size: 10pt;
}
.undangan-closing {
  margin-top: 10px;
  text-align: justify;
  text-indent: 28px;
}

.lampiran-header-meta { margin-bottom: 8px; }

.continuation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #000000;
  padding-bottom: 5px;
  margin-bottom: 10px;
  font-size: 10pt;
}

/* Daftar Hadir */
.hadir-meta-table {
  margin-bottom: 8px;
}
.hadir-meta-table td {
  font-size: 10pt;
  padding: 2px 4px 2px 0;
}
.hadir-row td {
  height: 28px;
  vertical-align: middle !important;
}
.hadir-ttd-cell {
  width: 88px;
  font-size: 9pt !important;
  color: #1e293b;
  white-space: nowrap;
}

/* Notulen */
.notulen-meta-table td {
  padding: 3px 6px !important;
  font-size: 10pt !important;
}
.notulen-sections {
  margin-top: 10px;
}
.notulen-sec-block {
  margin-bottom: 10px;
}
.notulen-sec-title {
  font-size: 10.5pt;
  font-weight: bold;
  margin-bottom: 4px;
  color: #000000;
}
.notulen-text-box {
  font-size: 10.2pt;
  line-height: 1.4;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  min-height: 44px;
}
.manual-write-box {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
}
.write-line {
  height: 21px;
  border-bottom: 1px dotted #94a3b8;
  width: 100%;
}
.notulen-blank-line {
  height: 25px;
  border-bottom: 1px dotted #64748b;
}

/* Signature Block */
.doc-signature-block {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  page-break-inside: avoid;
}
.signature-left { width: 52%; }
.signature-right { width: 44%; text-align: left; margin-left: auto; }
.tembusan-title { font-size: 9.5pt; text-decoration: underline; margin-bottom: 2px; }
.tembusan-list { font-size: 9pt; margin-left: 16px; }
.sig-date { font-size: 10.5pt; margin-bottom: 3px; }
.sig-role-title, .sig-sub-title { font-size: 10.5pt; margin: 0; }
.sig-space { height: 60px; }
.sig-name { font-size: 10.5pt; font-weight: normal; margin: 0; }
.sig-pangkat, .sig-nip { font-size: 10pt; margin: 0; }

/* PDF Export cleanup */
body.is-exporting-pdf,
body.is-exporting-pdf .app-container,
body.is-exporting-pdf .preview-panel,
body.is-exporting-pdf .preview-viewport,
body.is-exporting-pdf #document-preview-container {
  padding: 0 !important;
  margin: 0 !important;
  background: #ffffff !important;
  box-shadow: none !important;
  border: none !important;
  overflow: visible !important;
}
body.is-exporting-pdf .document-sheet {
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  margin: 0 auto !important;
}
body.is-exporting-pdf .document-sheet:not(:last-of-type) {
  page-break-after: always !important;
  break-after: page !important;
}
body.is-exporting-pdf .no-print { display: none !important; }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalFadeIn 0.18s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--slate-50);
}
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--slate-900); }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--slate-50);
}

.btn-remove-row {
  background: transparent;
  color: var(--slate-400);
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-remove-row:hover { color: var(--danger-600); background: var(--danger-50); }

.drawer-box {
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
  background: var(--slate-50);
  border: 1px solid var(--slate-300);
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--slate-100);
  padding: 8px 10px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--slate-600);
  text-transform: uppercase;
  border-bottom: 2px solid var(--slate-200);
}
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--slate-200);
  font-size: 0.82rem;
  color: var(--slate-800);
  vertical-align: middle;
}
.data-table tr:hover { background: var(--slate-50); }

.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--slate-100);
  cursor: pointer;
}
.checklist-item:hover { background: var(--primary-50); }

/* ── Toast & User Badge ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #ffffff;
  color: var(--slate-800);
  padding: 11px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--primary-600);
  font-size: 0.84rem;
  font-weight: 600;
  min-width: 260px;
  animation: slideInRight 0.2s ease-out;
}
.toast.toast-success { border-left-color: var(--success-600); }
.toast.toast-error { border-left-color: var(--danger-600); }
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 40px;
  padding: 4px 12px 4px 4px;
}
.user-avatar, .user-avatar-placeholder {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
}
.user-avatar-placeholder {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
  color: #ffffff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.82rem;
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 0.76rem; font-weight: 700; color: var(--slate-800); }
.user-email { font-size: 0.67rem; color: var(--slate-500); }
.btn-logout { background: transparent; border: none; cursor: pointer; color: var(--slate-400); padding: 4px; display: flex; }
.btn-logout:hover { color: var(--danger-600); }

/* ── Mobile Responsive ── */
.mobile-nav-bar, .mobile-only-action { display: none; }

@media screen and (max-width: 991px) {
  .header-btn-label { display: none; }
  .brand-title-full { display: none; }
  .brand-title-mobile { display: inline; }
  .app-container {
    display: block !important;
    height: calc(100vh - var(--header-height) - 58px) !important;
    overflow: hidden !important;
  }
  .app-container:not(.view-preview-mode) .form-panel { display: block !important; width: 100%; height: 100%; border-right: none; }
  .app-container:not(.view-preview-mode) .preview-panel { display: none !important; }
  .app-container.view-preview-mode .form-panel { display: none !important; }
  .app-container.view-preview-mode .preview-panel { display: flex !important; width: 100%; height: 100%; }
  .mobile-only-action { display: block !important; }
  .mobile-nav-bar {
    display: flex !important;
    position: fixed; bottom: 0; left: 0; right: 0; height: 58px;
    background: #ffffff; border-top: 1px solid var(--slate-200); z-index: 999;
  }
  .mobile-nav-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; background: transparent; border: none; color: var(--slate-500); font-size: 0.72rem; font-weight: 600;
  }
  .mobile-nav-tab.active { color: var(--primary-600); }
}

@media screen and (max-width: 600px) {
  .form-row, .peserta-fields-grid { grid-template-columns: 1fr; }
}

/* ── Dark Mode ── */
body.dark-mode { background-color: #0b1120; color: #f1f5f9; }
body.dark-mode .app-header { background: rgba(11, 17, 32, 0.94); border-bottom-color: #1e293b; }
body.dark-mode .brand-text h1 { color: #f8fafc; }
body.dark-mode .brand-text p { color: #94a3b8; }
body.dark-mode .btn-secondary { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark-mode .btn-secondary:hover { background: #334155; color: #ffffff; }
body.dark-mode .form-panel { background: #0b1120; border-right-color: #1e293b; }
body.dark-mode .form-card { background: #131c2e; border-color: #1e293b; }
body.dark-mode .card-title-row { border-bottom-color: #1e293b; }
body.dark-mode .card-title { color: #f8fafc; }
body.dark-mode .card-subtitle, body.dark-mode .input-hint { color: #94a3b8; }
body.dark-mode .step-badge { background: #0f172a; color: #38bdf8; border: 1px solid #334155; }
body.dark-mode .form-label, body.dark-mode .checkbox-label { color: #cbd5e1; }
body.dark-mode .form-input, body.dark-mode .form-select, body.dark-mode .form-textarea {
  background: #0a0f1d; border-color: #334155; color: #f8fafc;
}
body.dark-mode .input-nomor-highlight { color: #38bdf8; }
body.dark-mode .input-readonly-highlight { background: #1e293b; color: #93c5fd; }
body.dark-mode .preset-btn { background: #1e293b; border-color: #334155; color: #cbd5e1; }
body.dark-mode .peserta-item-card, body.dark-mode .peserta-empty-box, body.dark-mode .signer-choice-box {
  background: #0a0f1d; border-color: #334155; color: #cbd5e1;
}
body.dark-mode .btn-mini-icon { background: #1e293b; border-color: #334155; color: #cbd5e1; }
body.dark-mode .autocomplete-dropdown { background: #131c2e; border-color: #334155; }
body.dark-mode .autocomplete-item { border-bottom-color: #1e293b; }
body.dark-mode .autocomplete-item:hover, body.dark-mode .autocomplete-item.active { background: #1e293b; }
body.dark-mode .item-name { color: #f8fafc; }
body.dark-mode .item-badge { background: #0f172a; color: #38bdf8; }
body.dark-mode .preview-panel { background: #060911; }
body.dark-mode .preview-toolbar, body.dark-mode .preview-page-bar { background: #0b1120; border-bottom-color: #1e293b; }
body.dark-mode .template-tabs { background: #131c2e; }
body.dark-mode .tab-btn { color: #94a3b8; }
body.dark-mode .tab-btn.active { background: #1e293b; color: #38bdf8; }
body.dark-mode .page-pill { background: #131c2e; border-color: #334155; color: #cbd5e1; }
body.dark-mode .page-pill.active { background: #2563eb; border-color: #2563eb; color: #ffffff; }
body.dark-mode .preview-viewport { background: radial-gradient(circle at center, #172136 0%, #060911 100%); }
body.dark-mode .modal-dialog { background: #131c2e; color: #f1f5f9; }
body.dark-mode .modal-header, body.dark-mode .modal-footer { background: #0b1120; border-color: #1e293b; }
body.dark-mode .modal-title { color: #f8fafc; }
body.dark-mode .data-table th { background: #0b1120; color: #94a3b8; border-bottom-color: #1e293b; }
body.dark-mode .data-table td { border-bottom-color: #1e293b; color: #cbd5e1; }
body.dark-mode .data-table tr:hover td { background: #1e293b; }
body.dark-mode .user-badge { background: #1e293b; border-color: #334155; }
body.dark-mode .user-name { color: #f8fafc; }
body.dark-mode .mobile-nav-bar { background: #0b1120; border-top-color: #1e293b; }
body.dark-mode .document-sheet { background: #ffffff !important; color: #000000 !important; }

