:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --primary: #146c5b;
  --primary-dark: #0f5548;
  --primary-light: #e4f2ee;
  --accent: #c9962c;
  --accent-light: #faf1dc;
  --text: #1b2430;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #c0392b;
  --danger-light: #fbeae8;
  --success: #1e8e5a;
  --success-light: #e5f5ed;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; }

.hidden { display: none !important; }

/* ---------- Eyebrow / section labels (signature typographic treatment) ---------- */
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--primary);
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--primary-dark), var(--primary) 55%, #1c8a73);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  width: 100%;
  max-width: 380px;
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card h1 {
  font-size: 20px;
  margin: 4px 0 2px;
}
.login-card .eyebrow { display: block; margin-bottom: 6px; }
.login-card p.sub { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.login-logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--primary-light); color: var(--primary-dark); }
.btn-secondary:hover { background: #d5ebe4; }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover { background: #f6d7d3; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef1f4; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 226px; flex-shrink: 0;
  background: var(--primary-dark);
  color: #eafaf4;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform 0.2s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; font-weight: 800; font-size: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-brand .login-logo { width: 34px; height: 34px; font-size: 14px; background: var(--accent); color: #3a2a06; }
.sidebar nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; margin-bottom: 2px;
  color: rgba(255,255,255,0.78); font-size: 13.5px; font-weight: 600;
  cursor: pointer; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.14); color: #fff; }
.nav-icon { width: 18px; text-align: center; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 12px; }
.sidebar-footer .who { font-weight: 700; color: #fff; margin-bottom: 2px; }
.sidebar-footer .role-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em;
  background: var(--accent); color: #3a2a06; padding: 2px 8px; border-radius: 100px; margin: 4px 0 8px;
}

.main {
  margin-left: 226px; flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 22px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 17px; }
.topbar .subtitle { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.hamburger { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); }

.content { padding: 20px 22px 60px; max-width: 1280px; }

/* ---------- Cards / stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; border-left: 4px solid var(--primary);
}
.stat-card.accent { border-left-color: var(--accent); }
.stat-card .stat-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stat-card .stat-value { font-size: 28px; font-weight: 800; margin-top: 4px; color: var(--text); }
.stat-card .stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.dash-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.dash-tab {
  background: none; border: none; padding: 9px 16px; font-size: 13.5px; font-weight: 700;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.dash-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.panel-title { font-size: 14.5px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.chart-box canvas { max-height: 260px; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar input[type=text], .toolbar select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; background: #fff;
}
.toolbar .search-box { flex: 1; min-width: 180px; }
.spacer { flex: 1; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
table.data-table th, table.data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data-table th { background: #fafbfc; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; position: sticky; top: 0; }
table.data-table tbody tr:hover { background: #f8fbfa; }
.avatar-chip { display: inline-flex; align-items: center; gap: 8px; }
.avatar-dot {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.badge { display: inline-block; padding: 3px 9px; border-radius: 100px; font-size: 11px; font-weight: 700; }
.badge.status-aktif { background: var(--success-light); color: var(--success); }
.badge.status-nonaktif, .badge.status-lulus, .badge.status-cuti { background: #eef1f4; color: var(--muted); }
.badge.status-default { background: var(--accent-light); color: #8a6a1c; }
.row-actions { display: flex; gap: 6px; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; gap: 10px; flex-wrap: wrap; }
.pagination .info { color: var(--muted); font-size: 12.5px; }

/* ---------- Mobile card list (alternative to table) ---------- */
.mobile-card-list { display: none; }
.m-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 10px; overflow: hidden;
}
.m-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.m-card-head .avatar-chip { min-width: 0; }
.m-card-head .avatar-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; max-width: 100%; vertical-align: middle; }
.m-card-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.m-card-row:last-of-type { border-bottom: none; }
.m-card-row .k { color: var(--muted); flex-shrink: 0; }
.m-card-row span:last-child { text-align: right; word-break: break-word; overflow-wrap: anywhere; max-width: 60%; }
.m-card-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 30, 0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 30px 14px; overflow-y: auto; z-index: 100;
}
.modal {
  background: var(--surface); border-radius: 14px; width: 100%; max-width: 720px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px 20px; max-height: 68vh; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.close-x { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }

/* ---------- Import/export ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px 20px;
  text-align: center; color: var(--muted); background: #fafcfb; cursor: pointer;
}
.dropzone.drag { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }

/* ---------- Multi-select nilai scope (checkbox list) ---------- */
.multi-select {
  display: flex; flex-wrap: wrap; gap: 6px; max-height: 160px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px;
}
.ms-option {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px;
  background: #f4f7f6; border-radius: 6px; padding: 4px 9px; cursor: pointer;
}
.ms-option input { margin: 0; }

/* ---------- Tombol ikon buka file (R2) ---------- */
.btn-file-icon {
  border: 1px solid var(--border); background: var(--primary-light); color: var(--primary-dark);
  border-radius: 7px; width: 30px; height: 30px; flex-shrink: 0; font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.btn-file-icon:hover { background: #d5ebe4; }
.btn-file-icon.disabled { background: #f1f3f4; color: var(--muted); cursor: not-allowed; opacity: 0.6; }
.field-with-file { display: flex; gap: 6px; align-items: center; }
.field-with-file input { flex: 1; min-width: 0; }

/* ---------- Tombol ikon WhatsApp (hubungi & bagikan biodata) ---------- */
.btn-wa-icon {
  border: 1px solid var(--border); background: var(--success-light); color: var(--success);
  border-radius: 7px; width: 30px; height: 30px; flex-shrink: 0; font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.btn-wa-icon:hover { background: #d3f0e0; }
.btn-wa-icon.disabled, .btn-wa-icon[disabled] { background: #f1f3f4; color: var(--muted); cursor: not-allowed; opacity: 0.6; }

/* ---------- Popup pilihan nomor WhatsApp (Indonesia / Saudi) ---------- */
.wa-choice-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; padding: 12px 14px;
}
.wa-choice-btn .wa-choice-num { font-weight: 400; opacity: 0.85; font-size: 12.5px; }

/* ---------- Field yang dikunci ke scope admin (admin_kampus/admin_angkatan) ---------- */
.locked-input {
  background: var(--primary-light) !important;
  color: var(--primary-dark) !important;
  cursor: not-allowed;
  border-color: var(--primary-light) !important;
}
.import-report table { width: 100%; font-size: 12.5px; border-collapse: collapse; margin-top: 10px; }
.import-report th, .import-report td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow); min-width: 220px; animation: toast-in 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---------- Daftar akun baru menunggu verifikasi (dashboard) ---------- */
.pending-akun-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 4px; border-bottom: 1px dashed var(--border);
}
.pending-akun-row:last-child { border-bottom: none; }
.pending-akun-info { min-width: 0; }
.pending-akun-info .pa-nama { font-weight: 700; font-size: 13.5px; }
.pending-akun-info .pa-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pending-akun-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- Badge status akun (Menunggu Verifikasi / Aktif / Diblokir) ---------- */
.badge.akun-menunggu { background: var(--accent-light); color: #8a6a1c; }
.badge.akun-aktif { background: var(--success-light); color: var(--success); }
.badge.akun-diblokir { background: var(--danger-light); color: var(--danger); }

/* ---------- Pengaturan Kolom ---------- */
.cr-role-list { display: flex; flex-wrap: wrap; gap: 8px; max-width: 260px; }
.cr-role-list label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: #f4f7f6; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.cr-role-list label input { margin: 0; }

/* ---------- Mini table (dipakai di dalam panel, mis. paspor kadaluarsa) ----------
   Di desktop tampil sebagai tabel biasa; di mobile berubah jadi daftar kartu
   supaya kolom seperti "Domisili"/nama panjang tidak melebar keluar layar. */
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table th, .mini-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.mini-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
@media (max-width: 700px) {
  .mini-table thead { display: none; }
  .mini-table, .mini-table tbody, .mini-table tr, .mini-table td { display: block; width: 100%; }
  .mini-table tr { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; padding: 4px 10px; }
  .mini-table td { border: none; padding: 5px 0; display: flex; justify-content: space-between; gap: 10px; word-break: break-word; }
  .mini-table td::before { content: attr(data-label); font-weight: 700; color: var(--muted); font-size: 10.5px; text-transform: uppercase; flex-shrink: 0; }
}
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: spin 0.7s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.bottom-nav { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: inline-block; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .content { padding: 14px 12px 80px; }
  .table-wrap { display: none; }
  .mobile-card-list { display: block; }
  .topbar { padding: 12px 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card .stat-value { font-size: 22px; }
  .toolbar select, .toolbar input[type=text] { flex: 1 1 100%; width: 100%; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-box canvas { max-height: 220px; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
}
