/* ============================================================
   SMARTKIDZ THEME — tambahan template
   Dimuat SETELAH app.css (salinan smartkidz_hr/public/css/app.css).
   Hanya berisi kelas baru; tidak menimpa gaya bawaan HR.
   ============================================================ */

/* ---------- Util ---------- */
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.gap-8 { gap: 8px; }
.flex { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.span-2 { grid-column: 1 / -1; }

/* ---------- Kepala halaman ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.page-head h2 { font-size: 20px; letter-spacing: -.01em; }
.page-head p { font-size: 13px; color: var(--text-3); font-weight: 600; margin-top: 2px; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head-actions .btn { height: 36px; padding: 0 14px; }
.page-head-actions .btn svg { width: 16px; height: 16px; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.crumbs a:hover { color: var(--primary); }
.crumbs span[aria-hidden] { opacity: .5; }
.crumbs b { color: var(--text-2); font-weight: 700; }

/* ---------- Alert ---------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.5;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert b { font-weight: 800; }
.alert-info { background: #eef5fd; color: #1e5a99; border-color: #d6e6f8; }
.alert-ok { background: var(--success-tint); color: var(--success); border-color: rgba(22, 163, 74, .18); }
.alert-warn { background: var(--warn-tint); color: #a35a04; border-color: rgba(217, 119, 6, .2); }
.alert-danger { background: var(--danger-tint); color: var(--danger); border-color: rgba(220, 38, 38, .18); }
html[data-theme="dark"] .alert-info { background: rgba(96, 165, 250, .12); color: #93c5fd; border-color: rgba(96, 165, 250, .2); }
html[data-theme="dark"] .alert-warn { color: var(--warn); }

/* ---------- Form tambahan ---------- */
.form-card-body { padding: 20px 22px 22px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-section-desc { font-size: 12.5px; color: var(--text-3); font-weight: 600; margin: -6px 0 14px; }
.field-note { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.form-actions.is-right { justify-content: flex-end; }
.form-actions .btn-danger { margin-right: auto; }
@media (max-width: 900px) { .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .form-grid-3 { grid-template-columns: 1fr; } }

.side-card .card-body { display: flex; flex-direction: column; gap: 12px; }
.meta-list { display: flex; flex-direction: column; gap: 0; }
.meta-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.meta-list > div:last-child { border-bottom: none; }
.meta-list dt { color: var(--text-3); font-weight: 600; }
.meta-list dd { font-weight: 700; text-align: right; }

/* ---------- Detail data ---------- */
.detail-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  flex-wrap: wrap;
}
.detail-hero .avatar-lg {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-soft), var(--primary));
  flex-shrink: 0;
}
.detail-hero h2 { font-size: 19px; }
.detail-hero p { font-size: 13px; color: var(--text-3); font-weight: 600; }
.detail-hero .detail-tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.detail-hero .detail-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.detail-hero .detail-actions .btn { height: 34px; padding: 0 12px; }
.detail-hero .detail-actions .btn svg { width: 15px; height: 15px; }
.kv-list.kv-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv-list.kv-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kv-item b { display: block; margin-top: 2px; word-break: break-word; }
@media (max-width: 900px) { .kv-list.kv-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .kv-list.kv-2, .kv-list.kv-4 { grid-template-columns: 1fr; } }

/* ---------- Tabel: footer total ---------- */
.data-table tfoot td {
  padding: 11px 14px;
  font-weight: 800;
  background: var(--surface-2);
  border-top: 2px solid var(--border-strong);
}
.data-table.is-compact { min-width: 0; }
.data-table.is-compact td, .data-table.is-compact th { padding: 8px 12px; }

/* ---------- Pengaturan ---------- */
.settings-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.set-nav { padding: 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.set-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.set-nav button svg { width: 17px; height: 17px; flex-shrink: 0; }
.set-nav button:hover { background: var(--primary-tint); color: var(--primary); }
.set-nav button.active { background: var(--primary-tint); color: var(--primary); }
.set-panel { display: none; }
.set-panel.active { display: block; }
.set-panel .card + .card { margin-top: 16px; }
.switch-list { display: flex; flex-direction: column; }
.switch-list .switch-row { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.switch-list .switch-row:last-child { border-bottom: none; }
.logo-preview {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--surface-2);
}
.logo-preview img { height: 44px; width: auto; background: #fff; border-radius: 8px; padding: 4px 8px; }
.theme-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-choice label {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13px; font-weight: 700;
}
.theme-choice input { position: absolute; opacity: 0; pointer-events: none; }
.theme-choice label:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.theme-swatch { height: 54px; border-radius: 8px; border: 1px solid var(--border); display: grid; grid-template-columns: 30% 1fr; overflow: hidden; }
.theme-swatch i:first-child { border-right: 1px solid rgba(0,0,0,.06); }
.theme-swatch.light i:first-child { background: #fff; } .theme-swatch.light i:last-child { background: #f7f6f4; }
.theme-swatch.dark i:first-child { background: #161014; } .theme-swatch.dark i:last-child { background: #0c0e13; }
.theme-swatch.auto i:first-child { background: linear-gradient(135deg, #fff 50%, #161014 50%); } .theme-swatch.auto i:last-child { background: linear-gradient(135deg, #f7f6f4 50%, #0c0e13 50%); }
.perm-table td:not(:first-child), .perm-table th:not(:first-child) { text-align: center; width: 92px; }
.perm-table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; }
  .set-nav button { white-space: nowrap; width: auto; }
  .theme-choice { grid-template-columns: 1fr; }
}

/* ---------- Import ---------- */
.step-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.step-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
}
.step-item b {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--primary-tint); color: var(--primary); font-size: 12px;
}
.step-item strong { display: block; font-size: 13px; }
.step-item span { font-size: 12px; color: var(--text-3); font-weight: 600; }
.step-item.done b { background: var(--success); color: #fff; }
@media (max-width: 720px) { .step-list { grid-template-columns: 1fr; } }

/* ---------- Halaman galeri template ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tpl-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.tpl-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.tpl-card .tpl-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-tint); color: var(--primary); margin-bottom: 4px; }
.tpl-card .tpl-ico svg { width: 18px; height: 18px; }
.tpl-card strong { font-size: 14px; }
.tpl-card span { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.tpl-card code { font-size: 11.5px; color: var(--text-2); font-family: 'IBM Plex Sans', monospace; }

/* ---------- Halaman komponen ---------- */
.ui-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ui-label { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 18px 0 8px; }
.ui-label:first-child { margin-top: 0; }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.swatch { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; font-size: 12px; font-weight: 700; }
.swatch i { display: block; height: 42px; }
.swatch span { display: block; padding: 6px 10px; }
.swatch small { display: block; padding: 0 10px 8px; color: var(--text-3); font-family: 'IBM Plex Sans', monospace; }

/* ---------- Error / 404 ---------- */
.error-card { text-align: center; max-width: 460px; }
.error-code {
  font-size: 76px; font-weight: 800; line-height: 1; letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--primary-soft), var(--primary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 8px 0 6px;
}
.error-card h1 { font-size: 20px; margin-bottom: 6px; }
.error-card p { font-size: 13.5px; color: var(--text-3); font-weight: 600; margin-bottom: 20px; }
.error-card .ui-row { justify-content: center; }

/* ============================================================
   CETAK (dokumen A4)
   Lembar selalu putih, juga di mode gelap.
   ============================================================ */
.doc-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.doc-toolbar .ui-row .btn { height: 34px; padding: 0 12px; }
.doc-toolbar .btn svg { width: 15px; height: 15px; }
.doc-stage { overflow-x: auto; padding: 4px 0 8px; }
.doc-sheet {
  --ink: #111827;
  --ink-2: #4b5563;
  --line: #d1d5db;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 14mm 14mm 16mm;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  font-family: 'IBM Plex Sans', 'Segoe UI', Roboto, sans-serif;
  font-size: 10.5pt;
  line-height: 1.45;
  font-weight: 400;
  letter-spacing: 0;
  word-spacing: 0;
}
.doc-sheet.is-landscape { width: 297mm; min-height: 210mm; }
.doc-kop {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 10px; border-bottom: 3px double var(--ink);
}
.doc-kop img { height: 54px; width: auto; }
.doc-kop-text { flex: 1; }
.doc-kop-text h1 { font-size: 15pt; font-weight: 700; letter-spacing: .02em; }
.doc-kop-text p { font-size: 9pt; color: var(--ink-2); line-height: 1.4; }
.doc-kop-code { text-align: right; font-size: 8.5pt; color: var(--ink-2); }
.doc-title { text-align: center; margin: 16px 0 12px; }
.doc-title h2 { font-size: 12.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-decoration: underline; text-underline-offset: 3px; }
.doc-title p { font-size: 9.5pt; color: var(--ink-2); }
.doc-meta { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 10pt; }
.doc-meta td { padding: 2px 0; vertical-align: top; }
.doc-meta td:nth-child(1), .doc-meta td:nth-child(4) { width: 110px; color: var(--ink-2); }
.doc-meta td:nth-child(2), .doc-meta td:nth-child(5) { width: 10px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; font-variant-numeric: tabular-nums; }
.doc-table th, .doc-table td { border: 1px solid var(--line); padding: 5px 7px; vertical-align: top; }
.doc-table thead th { background: #f3f4f6; font-weight: 700; text-align: center; font-size: 9pt; text-transform: uppercase; letter-spacing: .02em; }
.doc-table tbody tr:nth-child(even) td { background: #fafafa; }
.doc-table tfoot td { font-weight: 700; background: #f3f4f6; }
.doc-table .c { text-align: center; }
.doc-table .r { text-align: right; white-space: nowrap; }
.doc-note { margin-top: 12px; font-size: 9pt; color: var(--ink-2); }
.doc-note ol { padding-left: 16px; }
.doc-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; text-align: center; font-size: 10pt; break-inside: avoid; }
.doc-sign .sign-space { height: 64px; }
.doc-sign b { display: block; text-decoration: underline; text-underline-offset: 2px; }
.doc-sign small { color: var(--ink-2); font-size: 9pt; }
.doc-foot { margin-top: 22px; padding-top: 6px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 8pt; color: var(--ink-2); }

@page { size: A4 portrait; margin: 12mm; }

@media print {
  html, body { background: #fff !important; }
  .sidebar, .sidebar-backdrop, .topbar, .page-foot, .no-print, .toast-wrap, .backdrop { display: none !important; }
  .layout, .main { display: block !important; }
  .content { padding: 0 !important; gap: 0 !important; }
  .doc-stage { padding: 0; overflow: visible; }
  .doc-sheet { box-shadow: none; border-radius: 0; margin: 0; padding: 0; width: auto; min-height: 0; }
  .doc-table thead { display: table-header-group; }
  .doc-table tfoot { display: table-row-group; }
  .doc-table tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Jarak antarbagian di dalam section halaman ---------- */
.content > section:not(#page-dashboard) { display: flex; flex-direction: column; gap: 16px; }
.content > section.page:not(.active) { display: none; }

/* .form-actions bawaan HR memakai margin negatif untuk duduk di dalam .card-body.
   Bila diletakkan langsung sebagai anak .card (pola template ini), margin dinolkan. */
.card > .form-actions { margin: 0; }

/* Di layar kecil HR membuat kartu #page-data full-bleed (padding .content = 0).
   Elemen non-kartu (judul, statistik) tetap diberi jarak tepi. */
@media (max-width: 900px) {
  #page-data > :not(.card), .content > .doc-toolbar { padding-left: 16px; padding-right: 16px; }
  #page-data > .two-col > :not(.card) { margin: 0 16px; }
}
