:root {
  /* Joyful & Uplifting Theme */
  --white: #ffffff;
  --bg: #f4f7f6;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;

  --blue: #0ea5e9;     /* Sky Blue */
  --blue-d: #0284c7;   /* Sky Blue Dark */
  --green: #10b981;    /* Emerald */
  --green-d: #059669;  /* Emerald Dark */
  --orange: #f59e0b;   /* Amber */
  --orange-d: #d97706; /* Amber Dark */
  --red: #f43f5e;      /* Rose */
  --red-d: #e11d48;    /* Rose Dark */
  --purple: #8b5cf6;   /* Violet */
  --purple-d: #7c3aed; /* Violet Dark */

  --blue-soft: #f0f9ff;
  --green-soft: #ecfdf5;
  --orange-soft: #fffbeb;
  --red-soft: #fff1f2;
  --purple-soft: #f5f3ff;

  --sidebar: #1e1b4b;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
  --radius: 1rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; }

/* ===================== Layar autentikasi ===================== */
.auth-screen {
  position: fixed; inset: 0; z-index: 100; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  background: var(--bg);
}
.auth-card {
  background: var(--white); border-radius: var(--radius); padding: 36px 34px 26px; width: 100%;
  max-width: 480px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.auth-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
  padding-bottom: 24px; border-bottom: 1px solid var(--line);
}
.auth-brand .brand-logo { width: 64px; height: 64px; }
.auth-foot {
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line);
  text-align: center; font-size: 11px; color: var(--muted); letter-spacing: .2px;
}
.auth-brand .brand-name { font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1; letter-spacing: -0.025em; }
.auth-brand .brand-tag { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.auth-tab {
  flex: 1; padding: 10px; border: 1px solid var(--line); background: var(--white);
  border-radius: 0.5rem; cursor: pointer; font-weight: 500; font-size: 13px; color: var(--muted);
  transition: all .15s;
}
.auth-tab.active { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink); }
.pwd-wrap { position: relative; display: flex; align-items: center; }
.pwd-wrap input { width: 100%; padding-right: 44px; }
.pwd-toggle { position: absolute; right: 4px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 6px; border-radius: 4px; }
.pwd-toggle:hover { color: var(--ink); background: var(--bg); }
.auth-form input {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 0.5rem; font-size: 14px;
  transition: border-color 0.15s; outline: none;
}
.auth-form input:focus { border-color: var(--blue); border-width: 1.5px; padding: 9.5px 11.5px; }
.btn.full { width: 100%; }
.auth-hint { font-size: 12px; color: var(--muted); margin: 0; text-align: center; }

/* ===================== Layout ===================== */
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 256px; flex-shrink: 0; background: var(--sidebar); color: #fff;
  display: flex; flex-direction: column; padding: 0;
  position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 24px; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 0.25rem;
  object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.025em; line-height: 1; color: #fff; text-transform: uppercase; }
.brand-tag { display: none; }
.brand-full { display: none; }

.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 16px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: none; color: #94a3b8; /* slate-400 */
  padding: 8px 12px; border-radius: 0.375rem; cursor: pointer; font-size: 14px;
  font-weight: 500; transition: all .15s; position: relative;
}
.nav-item .ni-ico {
  width: 20px; height: 20px; display: inline-flex; align-items: center;
  justify-content: center; flex-shrink: 0; opacity: 0.8;
}
.nav-item .ni-ico svg { width: 20px; height: 20px; }
.nav-item:hover { background: #1e293b; color: #fff; } /* hover:bg-slate-800 text-white */
.nav-item.active {
  background: var(--blue); color: #fff;
  box-shadow: none;
}
.nav-item.active .ni-ico { color: #fff; opacity: 1; }

.nav-sep {
  height: 1px; background: #1e293b; margin: 16px 4px 12px;
}

.side-foot {
  margin-top: auto; border-top: 1px solid #1e293b; padding: 16px;
  font-size: 11px; line-height: 1.5; color: #94a3b8;
}
.sf-org { font-weight: 600; color: #fff; font-size: 12px; }
.sf-copy { letter-spacing: 0; margin-top: 2px; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: 256px; }
.main-head {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 0 32px; background: var(--white); height: 64px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.head-left { min-width: 0; }
.main-head h1 { margin: 0; font-size: 20px; letter-spacing: -0.025em; font-weight: 700; color: var(--ink); }
.head-left p.muted { display: none; } /* Hide view description if needed, or style it */

.head-right {
  display: flex; align-items: center; gap: 16px;
}
.head-meta { display: flex; align-items: center; gap: 12px; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500;
  color: var(--muted); background: var(--bg); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 0.375rem; white-space: nowrap;
}
.meta-chip svg { width: 16px; height: 16px; opacity: 0.5; color: var(--muted); }
.meta-chip.jenjang { background: var(--white); border-color: var(--line); color: var(--ink); font-weight: 600; padding-right: 8px; }
.meta-chip.jenjang select {
  border: none; background: transparent; font-size: 12px; font-weight: 600; color: var(--ink);
  cursor: pointer; outline: none; padding-right: 8px;
}
.meta-chip.src { color: var(--muted); font-weight: 500; }
.meta-chip.src .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); display: inline-block; }
.meta-chip.src .dot.upload { background: var(--green); }
.meta-chip.src #src-time { font-weight: 400; }

.head-actions { display: flex; align-items: center; gap: 12px; }
.head-divider { width: 1px; height: 24px; background: var(--line); margin: 0; }
.user-chip {
  display: inline-flex; align-items: center; gap: 12px; padding: 0;
  background: transparent; border: none; border-radius: 0;
}
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #334155; color: #fff; font-weight: 600; font-size: 13px;
}
.user-chip.guest .avatar { background: var(--orange); }
.user-chip #auth-who { color: var(--ink); font-weight: 500; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

.main-body { padding: 32px; }

/* ===================== Komponen ===================== */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 16px; font-size: 14px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.card-inner {
  margin-top: 16px; padding: 16px; border-radius: 0.5rem;
  background: var(--orange-soft); border: 1px solid #fde68a;
}
.rumus-chip {
  display: inline-block; background: var(--white); color: var(--muted);
  border: 1px solid var(--line); padding: 8px 16px; border-radius: 0.5rem; font-size: 12px;
}

.alert {
  background: var(--orange-soft); border: 1px solid #fde68a; color: #92400e;
  padding: 16px; border-radius: 0.5rem; margin-bottom: 24px; box-shadow: var(--shadow);
}
.alert code { background: rgba(0, 0, 0, .05); padding: 2px 6px; border-radius: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--blue); color: #fff; border: 1px solid var(--blue); padding: 8px 16px;
  border-radius: 0.375rem; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--blue-d); border-color: var(--blue-d); }
.btn:active { transform: none; }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn-ghost { background: var(--white); color: var(--muted); border-color: var(--line); box-shadow: none; font-weight: 500; }
.btn-ghost:hover { background: var(--bg); border-color: #cbd5e1; color: var(--ink); }

/* Tombol ikon (mis. Keluar) */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border-radius: 0.375rem; cursor: pointer;
  background: transparent; color: var(--muted); border: none;
  transition: all .15s;
}
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:hover { color: var(--blue); background: var(--blue-soft); }
.btn-icon:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- KPI ---------- */
.scope-note {
  display: flex; align-items: center; gap: 16px; margin-bottom: 24px;
  background: var(--blue-soft); border: 1px solid #bfdbfe;
  border-radius: 0.5rem; padding: 16px 20px;
}
.scope-note:hover { transform: none; box-shadow: none; }
.scope-icon { display: none; }
.scope-label { display: none; }
.scope-text { font-size: 13px; font-weight: 500; color: var(--blue-d); margin: 0; line-height: 1.5; }
.scope-hl { font-weight: 700; border-bottom: 1px dashed var(--blue); padding-bottom: 1px; }

.kpi-wrap { display: flex; flex-direction: column; gap: 0; margin-bottom: 24px; }
.kpi-group-title { display: none; }
.kpi-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(4, 1fr);
}
.kpi {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); border-left: none; position: relative;
}
.kpi.dragging { opacity: 0.5; }
.kpi.drag-over { border: 1px dashed var(--blue); }
.kpi-drag-handle {
  position: absolute;
  top: 12px;
  right: 12px;
  cursor: grab;
  color: var(--line);
  font-size: 20px;
  line-height: 1;
  user-select: none;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
}
.kpi:hover .kpi-drag-handle { opacity: 1; }
.kpi-drag-handle:hover { color: var(--muted); }
.kpi:active .kpi-drag-handle { cursor: grabbing; color: var(--blue); }

.kpi .l { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; margin-bottom: 4px; margin-top: 0; }
.kpi .v { font-size: 24px; font-weight: 700; line-height: 1; color: var(--ink); }

.kpi.blue .v { color: var(--blue-d); }
.kpi.green .v { color: var(--green-d); }
.kpi.orange .v { color: var(--orange-d); }
.kpi.red .v { color: var(--red-d); }
.kpi.purple .v { color: var(--purple-d); }

/* ---------- Chart ---------- */
.chart { display: flex; flex-direction: column; gap: 12px; }
.chart-row { display: grid; grid-template-columns: 160px 1fr 70px; align-items: center; gap: 16px; }
.chart-row .name { font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars { display: flex; flex-direction: column; gap: 4px; }
.bar { height: 8px; border-radius: 999px; min-width: 4px; }
.bar.keb { background: var(--orange-d); opacity: 0.7; }
.bar.asn { background: var(--blue-d); }
.chart-row .val { font-size: 12px; color: var(--muted); text-align: right; }

/* Agama Stats Grid */
.agamas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.agama-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 16px; cursor: pointer; transition: all 0.2s; }
.agama-card:hover { border-color: #cbd5e1; background: #f1f5f9; transform: translateY(-1px); }
.agama-card .agama-title { font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.agama-card .agama-val { font-size: 20px; font-weight: 700; color: #0f172a; }

/* Modal Agama */
#modal-agama-list { max-height: 50vh; overflow-y: auto; margin-top: 16px; }
.agama-list-item { display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
.agama-list-item:last-child { border-bottom: none; }
.agama-list-item .al-name { font-weight: 500; color: #334155; }
.agama-list-item .al-val { color: #0f172a; font-weight: 600; }
.legend { display: flex; gap: 20px; margin-top: 16px; font-size: 12px; font-weight: 500; color: var(--muted); justify-content: center; border-top: 1px solid var(--line); padding-top: 16px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: baseline; margin-right: 6px; }
.sw-keb { background: var(--orange-d); opacity: 0.7; } .sw-asn { background: var(--blue-d); }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; color: var(--ink); gap: 6px; }
.filters select, .filters input {
  font-size: 13px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 0.375rem;
  background: var(--white); color: var(--ink); min-width: 160px; outline: none; transition: border-color 0.15s;
}
.filters select:focus, .filters input:focus { border-color: var(--blue); }
.filters .search input { min-width: 240px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .table-wrap { border: none; box-shadow: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; margin: 0 -24px 0 -24px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; top: 0; box-shadow: inset 0 -1px 0 var(--line); white-space: nowrap; }
td { color: #334155; padding-top: 14px; padding-bottom: 14px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); cursor: pointer; }

#tabel-mutasi th, #tabel-mutasi td { padding: 10px 10px; }
#tabel-mutasi td:last-child { text-align: center; }
#tabel-mutasi .kembalikan { cursor: pointer; background: var(--red-soft); color: var(--red-d); border: 1px solid #fecaca; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; transition: all 0.2s; }
#tabel-mutasi .kembalikan:hover { background: #fecaca; }

.pagin-wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; flex-wrap: wrap; gap: 12px; }
.pagination { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--white); }
.pagination button { background: none; border: none; border-right: 1px solid var(--line); padding: 6px 12px; font-size: 13px; color: var(--ink); cursor: pointer; transition: all 0.2s; font-weight: 500; }
.pagination button:last-child { border-right: none; }
.pagination button:hover:not(:disabled) { background: var(--bg); }
.pagination button.active { background: var(--blue-soft); color: var(--blue-d); font-weight: 600; }
.pagination button:disabled { color: var(--muted); cursor: not-allowed; opacity: 0.6; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.kekurangan { background: var(--red-soft); color: var(--red-d); }
.badge.cukup { background: var(--green-soft); color: var(--green-d); }
.badge.kelebihan { background: var(--blue-soft); color: var(--blue-d); }
.gap-neg { color: var(--red-d); font-weight: 700; }
.gap-pos { color: var(--blue-d); font-weight: 700; }
.gap-zero { color: var(--green-d); font-weight: 600; }
.ket-neg { color: var(--red-d); font-weight: 500; }
.ket-pos { color: var(--blue-d); font-weight: 500; }
.ket-zero { color: var(--green-d); font-weight: 500; }

/* ---------- Distribusi ---------- */
.dist-summary { display: flex; flex-wrap: wrap; gap: 32px; margin: 16px 0 24px; padding: 20px 24px; background: var(--bg); border-radius: 0.5rem; border: 1px solid var(--line); }
.dist-summary div { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.dist-summary b { font-size: 24px; font-weight: 700; display: block; color: var(--ink); margin-top: 4px; text-transform: none; }
.actions { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.tag { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 11px; background: var(--blue-soft); color: var(--blue-d); font-weight: 600; border: 1px solid #bfdbfe; }
.tag.intra { background: var(--green-soft); color: var(--green-d); border-color: #a7f3d0; }
.tag.antar { background: var(--orange-soft); color: var(--orange-d); border-color: #fde68a; }

/* ---------- Pemetaan mutasi ---------- */
.map-grid {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px;
  align-items: center; margin-bottom: 24px;
}
.map-col { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--white); box-shadow: var(--shadow); }
.map-col-head { font-weight: 700; font-size: 14px; margin-bottom: 16px; color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.map-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.map-filters label, .map-col label.full {
  display: flex; flex-direction: column; font-size: 12px; font-weight: 600; color: var(--ink); gap: 6px;
}
.map-col label.full { margin-top: 16px; }
.map-col select {
  width: 100%; font-size: 13px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 0.375rem; background: var(--white); color: var(--ink); outline: none; transition: border-color 0.15s;
}
.map-col select:focus { border-color: var(--blue); }
.map-col .btn.full { width: 100%; margin-top: 24px; padding: 10px; }
.map-arrow { align-self: center; font-size: 24px; color: #94a3b8; }
@media (max-width: 860px) { .map-grid { grid-template-columns: 1fr; } .map-arrow { display: none; } }

.kembalikan {
  background: var(--white); color: var(--red-d); border: 1px solid #fecdd3;
  padding: 6px 12px; border-radius: 0.375rem; cursor: pointer; font-size: 12px; font-weight: 600;
  transition: all 0.15s;
}
.kembalikan:hover { background: var(--red-soft); }
.badge.masuk { background: var(--orange-soft); color: var(--orange-d); margin-left: 8px; border: 1px solid #fde68a; }
.row-masuk { background: var(--orange-soft); }
/* Baris Kepala Sekolah pada daftar pegawai (modal) */
.badge.kepsek { background: var(--green-soft); color: var(--green-d); margin-left: 8px; border: 1px solid #a7f3d0; }
#modal-table tr.row-kepsek td { background: var(--green-soft); font-weight: 600; }
#modal-table tr.row-kepsek td:first-child { position: relative; }
#modal-table tr.row-kepsek td:first-child::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--green); }

/* ---------- Upload modal ---------- */
.upload-field { margin: 16px 0; }
.upload-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--ink); }
.upload-field input[type="file"], .upload-field input[type="text"] {
  width: 100%; font-size: 13px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 0.375rem; background: var(--white); outline: none;
}
.upload-field input[type="file"]:focus, .upload-field input[type="text"]:focus { border-color: var(--blue); }
.upload-status { font-size: 13px; margin-top: 16px; min-height: 20px; font-weight: 500; }
.upload-status.ok { color: var(--green-d); }
.upload-status.err { color: var(--red-d); }
.upload-status.busy { color: var(--blue); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(2px); border: none; display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.modal-box { background: var(--white); border-radius: var(--radius); padding: 32px; max-width: 960px; width: 100%; max-height: 85vh; overflow: auto; position: relative; box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); border: 1px solid var(--line); }
.modal-narrow { max-width: 600px; }
.modal-fullscreen { position: absolute; top: 16px; right: 56px; border: none; background: none; font-size: 24px; cursor: pointer; color: var(--muted); padding: 8px; border-radius: 0.375rem; transition: background 0.15s; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; }
.modal-fullscreen:hover { background: var(--bg); color: var(--ink); }
.modal-close { position: absolute; top: 16px; right: 24px; border: none; background: none; font-size: 24px; cursor: pointer; color: var(--muted); padding: 8px; border-radius: 0.375rem; transition: background 0.15s; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal.is-fullscreen { padding: 0; }
.modal.is-fullscreen .modal-box { max-width: 100vw; max-height: 100vh; height: 100vh; width: 100vw; border-radius: 0; padding: 48px 48px 48px; border: none; margin: 0; }
.modal h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: var(--ink); }
.modal p.muted { font-size: 13px; line-height: 1.5; }

/* ---------- Pengaturan ---------- */
.peng-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}
.peng-card-head {
  display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px;
}
.peng-icon {
  width: 48px; height: 48px; border-radius: 0.5rem; background: var(--bg);
  color: var(--muted); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.peng-icon svg { width: 24px; height: 24px; }
.peng-card-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: var(--ink); }
.peng-note { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; }

/* ---------- Responsif ---------- */
@media (max-width: 860px) {
  .main-head { height: auto; padding: 16px 24px; flex-wrap: wrap; }
  .head-left { width: 100%; margin-bottom: 12px; }
  .head-right { width: 100%; justify-content: space-between; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
/* Pills ringkasan jenjang di modal detail sekolah */
.jenjang-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 20px; }
.jenjang-pill  { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 0.375rem;
                 padding: 4px 12px; font-size: 12px; font-weight: 600; }

/* Pemilih periode pada head-meta */
.meta-chip.periode { gap: 8px; padding-right: 8px; }
.meta-chip.periode select {
  border: none; background: transparent; font-size: 12px; font-weight: 600; color: var(--ink);
  cursor: pointer; outline: none;
}

/* Input periode pada modal upload (Bulan + Tahun) */
.periode-input { display: flex; gap: 12px; }
.periode-input select { flex: 2; padding: 10px 12px; border: 1px solid var(--line); border-radius: 0.375rem; background: var(--white); outline: none; }
.periode-input select:focus { border-color: var(--blue); }
.periode-input input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 0.375rem; background: var(--white); outline: none; }
.periode-input input:focus { border-color: var(--blue); }

/* Segmented control */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 6px 0 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}
.seg-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 0.375rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.seg-btn:hover { color: var(--ink); background: rgba(0, 0, 0, 0.02); }
.seg-btn.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.seg-c {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--muted);
  background: var(--line);
}
.seg-btn.active .seg-c { color: var(--blue-d); background: var(--blue-soft); }
/* Varian ringkas untuk dipakai di dalam bar filter */
.seg-sm { margin: 0; }
.seg-sm .seg-btn { padding: 6px 12px; font-size: 11px; }

/* Pilihan dasar perhitungan pada bar filter Daftar Sekolah */
.filter-basis { display: flex; flex-direction: column; gap: 6px; }
.fb-label { font-size: 12px; color: var(--ink); font-weight: 600; }

/* Styling beda untuk tombol aktif Target ASN & Dasar Perhitungan */
#f-target .seg-btn.active {
  background: var(--blue-soft);
  color: var(--blue-d);
  box-shadow: 0 0 0 1px inset var(--blue-d), var(--shadow);
}
[data-theme="glass3d"] #f-target .seg-btn.active {
  background: rgba(14, 165, 233, 0.15); /* Soft blue transparent */
  box-shadow: 0 0 0 1px inset var(--blue-d), 0 2px 8px rgba(31, 38, 135, 0.18);
}

#f-basis .seg-btn.active {
  background: var(--green-soft);
  color: var(--green-d);
  box-shadow: 0 0 0 1px inset var(--green-d), var(--shadow);
}
[data-theme="glass3d"] #f-basis .seg-btn.active {
  background: rgba(16, 185, 129, 0.15); /* Soft emerald transparent */
  box-shadow: 0 0 0 1px inset var(--green-d), 0 2px 8px rgba(31, 38, 135, 0.18);
}

/* Daftar riwayat periode (Pengaturan) */
.periode-list { display: flex; flex-direction: column; gap: 12px; }
.periode-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: 0.5rem; background: var(--bg);
}
.periode-row .periode-label { font-weight: 600; color: var(--ink); font-size: 13px; }
.periode-row .tag { margin-left: 8px; }

/* Tombol bahaya (hapus/aksi destruktif) */
.btn-danger { background: var(--white); border-color: var(--line); color: var(--red-d); }
.btn-danger:hover { background: var(--red-soft); border-color: #fda4af; }

/* Pengelompokan optgroup pada dropdown guru */
#m-guru optgroup { font-weight: 600; color: var(--ink); background: var(--bg); }
#m-guru option { font-weight: 400; color: var(--ink); background: var(--white); }

/* Empty-state (belum ada data) */
.data-empty { background: var(--white); border: 1px dashed #cbd5e1; border-radius: var(--radius);
              padding: 48px 32px; text-align: center; max-width: 600px;
              margin: 32px auto; box-shadow: var(--shadow); }
.data-empty-icon { width: 48px; height: 48px; margin: 0 auto 16px; border-radius: 0.5rem;
                   display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.data-empty-icon svg { width: 24px; height: 24px; }
.data-empty h2 { margin: 0 0 8px; font-size: 18px; color: var(--ink); }
.data-empty p { margin: 0 auto 24px; max-width: 460px; line-height: 1.6; }

/* Aksi pada modal konfirmasi: rata kanan */
.konfirm-acts { justify-content: flex-end; margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; }

/* Toast (notifikasi sukses/gagal sesaat) */
.toast-wrap { position: fixed; right: 24px; bottom: 24px; z-index: 1000;
              display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 0.5rem;
         box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); font-size: 13px; max-width: 360px; font-weight: 500;
         opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: var(--red-d); }

@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: column; overflow-y: visible; z-index: auto; }
  .main { margin-left: 0; }
  .side-nav { flex-direction: row; flex-wrap: wrap; padding: 12px 16px; }
  .nav-item { width: auto; }
  .nav-sep { display: none; }
  .brand { display: flex; flex-direction: row; }
  .brand-logo { margin-bottom: 0; }
  .brand-name { font-size: 20px; text-transform: uppercase; color: #fff; font-weight: 800; letter-spacing: -0.05em; }
  .brand-text { display: flex; }
  .main-body { padding: 16px; }
  .main-head { padding: 16px; height: auto; }
  .kpi-grid { grid-template-columns: 1fr; }
  .dist-summary { gap: 16px; }
}

@media print {
  .sidebar, .main-head, .actions, .filters, .alert, .head-actions { display: none !important; }
  .app { display: block; }
  .card { box-shadow: none; border: 1px solid #cbd5e1; }
  body { background: #fff; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .kpi { break-inside: avoid; border: 1px solid #cbd5e1; }
  .table-wrap { overflow: visible; border: none; box-shadow: none; margin: 0; }
  .card > .table-wrap { margin: 0; border: none; }
}

/* ---------- Progress Loading Modal ---------- */
.text-center { text-align: center; }
.progress-spinner-container { margin: 12px 0 20px; display: flex; justify-content: center; align-items: center; }
.progress-spinner { animation: rotate-spinner 1.6s linear infinite; width: 44px; height: 44px; }
.progress-spinner .path { stroke: var(--blue); stroke-linecap: round; animation: dash-spinner 1.6s ease-in-out infinite; }
.progress-bar-container { background: var(--line); border-radius: 999px; height: 10px; width: 100%; margin: 20px 0 10px; overflow: hidden; position: relative; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue) 0%, var(--blue-d) 100%); border-radius: 999px; width: 0%; transition: width 0.15s ease; }
.progress-text-container { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 0 4px; }

@keyframes rotate-spinner {
  100% { transform: rotate(360deg); }
}
@keyframes dash-spinner {
  0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* Tag Baru Wrap */
.tag-baru-wrap { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0; font-size: 13px; font-weight: 500; cursor: pointer; padding: 4px 8px; background: #f0fdf4; color: #166534; border-radius: 4px; border: 1px solid #bbf7d0; }
.tag-baru-wrap input { cursor: pointer; }
.tag-badge { background: #166534; color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; margin-left: 6px; }

/* Checkbox styling for reasons (v1.2.0) */
.reasons-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  margin: 12px 0;
  background: var(--bg);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.reason-check-lbl {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  color: var(--ink) !important;
  cursor: pointer;
  margin-bottom: 0 !important;
}
.reason-check-lbl input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.text-input-alasan {
  margin-top: 8px;
  width: 100%;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  background: var(--white);
  outline: none;
}
.text-input-alasan:focus {
  border-color: var(--blue);
}
.badg-alasan {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===================================================================== */
/* ============ Pemilih Tema (Pengaturan ▸ Tampilan & Tema) ============= */
/* ===================================================================== */
.tema-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.tema-option {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 0.75rem;
  background: var(--white); cursor: pointer; transition: all 0.18s ease;
}
.tema-option:hover { border-color: #cbd5e1; background: var(--bg); }
.tema-option.active { border-color: var(--blue); background: var(--blue-soft); }
.tema-preview {
  position: relative; flex-shrink: 0; width: 72px; height: 52px; border-radius: 0.5rem;
  overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.06); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.tema-preview .tp-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 20px; background: var(--sidebar); }
.tema-preview .tp-line { position: absolute; left: 28px; right: 8px; top: 12px; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.14); }
.tema-preview .tp-line.short { top: 28px; right: 26px; background: rgba(0, 0, 0, 0.10); }
.tema-preview-default { background: var(--bg); }
.tema-preview-glass3d {
  background: radial-gradient(at 20% 20%, rgba(124, 58, 237, 0.55) 0, transparent 55%),
              radial-gradient(at 85% 15%, rgba(14, 165, 233, 0.55) 0, transparent 55%),
              radial-gradient(at 75% 90%, rgba(244, 63, 94, 0.45) 0, transparent 55%),
              #eef2ff;
}
.tema-preview-glass3d .tp-bar { background: rgba(30, 27, 75, 0.55); backdrop-filter: blur(4px); }
.tema-preview-glass3d .tp-line { background: rgba(255, 255, 255, 0.85); box-shadow: 0 1px 2px rgba(31, 38, 135, 0.25); }
.tema-preview-glass3d .tp-line.short { background: rgba(255, 255, 255, 0.6); }
.tema-meta { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.tema-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.tema-desc { line-height: 1.4; }
.tema-check {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue); color: #fff; opacity: 0; transform: scale(0.6); transition: all 0.18s ease;
}
.tema-check svg { width: 15px; height: 15px; }
.tema-option.active .tema-check { opacity: 1; transform: scale(1); }

/* ===================================================================== */
/* ============= TEMA: "Modern 3 Dimensi Glasses" (glass3d) ============= */
/* Glassmorphism — panel kaca buram + kedalaman 3D. Diaktifkan lewat      */
/* atribut <html data-theme="glass3d">. Hanya menimpa tampilan; tidak     */
/* mengubah struktur/markup sehingga aman untuk seluruh halaman.          */
/* ===================================================================== */
:root[data-theme="glass3d"] {
  --bg: #eef2ff;
  --white: rgba(255, 255, 255, 0.62);
  --ink: #1e293b;
  --muted: #475569;
  --line: rgba(255, 255, 255, 0.55);
  --sidebar: rgba(30, 27, 75, 0.55);
  --shadow: 0 8px 32px rgba(31, 38, 135, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  --radius: 1.25rem;
}

/* Latar belakang mesh berwarna (tetap di tempat saat menggulir) */
[data-theme="glass3d"] body {
  background:
    radial-gradient(at 18% 18%, rgba(124, 58, 237, 0.30) 0, transparent 50%),
    radial-gradient(at 82% 12%, rgba(14, 165, 233, 0.30) 0, transparent 50%),
    radial-gradient(at 72% 82%, rgba(244, 63, 94, 0.24) 0, transparent 50%),
    radial-gradient(at 12% 88%, rgba(16, 185, 129, 0.24) 0, transparent 50%),
    #eef2ff;
  background-attachment: fixed;
  min-height: 100vh;
}
[data-theme="glass3d"] .auth-screen { background: transparent; }

/* Permukaan kaca: kartu, KPI, tabel, modal, dsb. */
[data-theme="glass3d"] .card,
[data-theme="glass3d"] .kpi,
[data-theme="glass3d"] .table-wrap,
[data-theme="glass3d"] .auth-card,
[data-theme="glass3d"] .modal-box,
[data-theme="glass3d"] .data-empty,
[data-theme="glass3d"] .map-col {
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
/* Tabel di dalam kartu tidak perlu kaca ganda */
[data-theme="glass3d"] .card > .table-wrap {
  background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none;
  border: none; box-shadow: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}

/* Efek kedalaman 3D: kartu KPI & agama terangkat saat disentuh */
[data-theme="glass3d"] .kpi { transition: transform 0.25s ease, box-shadow 0.25s ease; }
[data-theme="glass3d"] .kpi:hover {
  transform: translateY(-6px) scale(1.012);
  box-shadow: 0 22px 44px rgba(31, 38, 135, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
[data-theme="glass3d"] .agama-card {
  background: rgba(255, 255, 255, 0.45); border: 1px solid rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: transform 0.2s ease, box-shadow 0.2s ease;
}
[data-theme="glass3d"] .agama-card:hover {
  background: rgba(255, 255, 255, 0.62); transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(31, 38, 135, 0.22);
}

/* Sidebar & header kaca */
[data-theme="glass3d"] .sidebar {
  background: rgba(30, 27, 75, 0.55);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  border-right: 1px solid rgba(255, 255, 255, 0.16);
}
[data-theme="glass3d"] .main-head {
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}
[data-theme="glass3d"] .nav-item:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
[data-theme="glass3d"] .nav-item.active {
  background: linear-gradient(135deg, var(--blue), var(--blue-d));
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.45);
}
[data-theme="glass3d"] .nav-sep,
[data-theme="glass3d"] .side-foot { border-color: rgba(255, 255, 255, 0.14); }

/* Tombol bergaya kaca dengan tekanan 3D */
[data-theme="glass3d"] .btn {
  background: linear-gradient(135deg, var(--blue), var(--blue-d));
  border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 0.6rem;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
[data-theme="glass3d"] .btn:hover {
  filter: brightness(1.05); transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(14, 165, 233, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
[data-theme="glass3d"] .btn:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(14, 165, 233, 0.4); }
[data-theme="glass3d"] .btn-ghost,
[data-theme="glass3d"] .btn-danger {
  background: rgba(255, 255, 255, 0.5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.6); box-shadow: 0 4px 12px rgba(31, 38, 135, 0.12);
}
[data-theme="glass3d"] .btn-ghost { color: var(--ink); }
[data-theme="glass3d"] .btn-danger { color: var(--red-d); }

/* Bidang input, chip, dan kontrol tersegmentasi */
[data-theme="glass3d"] .auth-form input,
[data-theme="glass3d"] .filters select,
[data-theme="glass3d"] .filters input,
[data-theme="glass3d"] .map-col select,
[data-theme="glass3d"] .upload-field input[type="file"],
[data-theme="glass3d"] .upload-field input[type="text"],
[data-theme="glass3d"] .periode-input select,
[data-theme="glass3d"] .periode-input input,
[data-theme="glass3d"] .text-input-alasan,
[data-theme="glass3d"] .meta-chip,
[data-theme="glass3d"] .seg,
[data-theme="glass3d"] .reasons-checkbox-grid {
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.6);
}
[data-theme="glass3d"] .seg-btn.active { background: rgba(255, 255, 255, 0.85); box-shadow: 0 2px 8px rgba(31, 38, 135, 0.18); }

/* Kepala tabel & baris */
[data-theme="glass3d"] th { background: rgba(255, 255, 255, 0.4); box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.5); }
[data-theme="glass3d"] tbody tr:hover { background: rgba(255, 255, 255, 0.35); }
[data-theme="glass3d"] td { border-bottom-color: rgba(255, 255, 255, 0.45); }

/* Pemilih tema: pratinjau aktif diberi lapisan kaca */
[data-theme="glass3d"] .tema-option { background: rgba(255, 255, 255, 0.5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
[data-theme="glass3d"] .tema-option.active { background: rgba(14, 165, 233, 0.16); }

/* Ikon Pengaturan & elemen bantu */
[data-theme="glass3d"] .peng-icon,
[data-theme="glass3d"] .data-empty-icon,
[data-theme="glass3d"] .rumus-chip,
[data-theme="glass3d"] .dist-summary,
[data-theme="glass3d"] .periode-row,
[data-theme="glass3d"] .card-inner {
  background: rgba(255, 255, 255, 0.45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.55);
}

/* Hormati preferensi pengguna yang mengurangi gerak (animasi 3D) */
@media (prefers-reduced-motion: reduce) {
  [data-theme="glass3d"] .kpi:hover,
  [data-theme="glass3d"] .agama-card:hover,
  [data-theme="glass3d"] .btn:hover,
  [data-theme="glass3d"] .btn:active { transform: none; }
}

