/* =========================================================
   SD NUHI — Tema: Gradasi modern, warna kalem (teal → indigo)
   ========================================================= */
:root {
  --grad-1: #5EEAD4;   /* teal muda */
  --grad-2: #7DD3FC;   /* sky muda */
  --grad-3: #A5B4FC;   /* indigo muda */
  --primary: #4F46E5;  /* indigo utama (kalem, tidak terlalu tua) */
  --primary-dark: #4338CA;
  --accent: #14B8A6;   /* teal aksen */
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E5E9F2;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(79, 70, 229, 0.08);
  --shadow-lg: 0 10px 40px rgba(79, 70, 229, 0.14);
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}
a { text-decoration: none; color: inherit; }

.gradient-bg {
  background: linear-gradient(135deg, var(--grad-1) 0%, var(--grad-2) 45%, var(--grad-3) 100%);
}
.gradient-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
}

/* ===================== LOGIN PAGES ===================== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #E0F2FE 0%, #EEF2FF 50%, #F0FDFA 100%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
  opacity: 0.25;
}
.auth-logo {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 26px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 20px rgba(79,70,229,0.3);
}
.auth-title { text-align: center; font-weight: 800; font-size: 22px; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

.role-tabs {
  display: flex; background: var(--bg); border-radius: 14px; padding: 4px; margin-bottom: 24px;
}
.role-tab {
  flex: 1; text-align: center; padding: 10px 0; border-radius: 10px; font-weight: 600;
  font-size: 14px; color: var(--text-muted); cursor: pointer; transition: all .2s;
}
.role-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.form-control-nuhi {
  width: 100%; padding: 13px 16px; border-radius: 12px; border: 1.5px solid var(--border);
  font-size: 14px; margin-bottom: 14px; background: var(--bg); transition: border .2s;
}
.form-control-nuhi:focus { outline: none; border-color: var(--primary); background: #fff; }

.btn-nuhi {
  width: 100%; padding: 13px 0; border: none; border-radius: 12px; font-weight: 700; font-size: 15px;
  color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--accent), var(--primary));
  box-shadow: 0 6px 18px rgba(79,70,229,0.28); transition: transform .15s, box-shadow .15s;
}
.btn-nuhi:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(79,70,229,0.35); }
.btn-nuhi:active { transform: translateY(0); }
.btn-nuhi.outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); box-shadow: none; }
.btn-nuhi.danger { background: linear-gradient(135deg, #F87171, var(--danger)); box-shadow: 0 6px 18px rgba(239,68,68,0.25); }
.btn-nuhi.sm { padding: 8px 14px; font-size: 13px; width: auto; }

.remember-row { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 13px; color: var(--text-muted); }

.alert-nuhi { padding: 12px 16px; border-radius: 12px; font-size: 13px; margin-bottom: 16px; }
.alert-nuhi.error { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-nuhi.success { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.alert-nuhi.info { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }

/* ===================== APP SHELL / DASHBOARD ===================== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; flex-shrink: 0; background: linear-gradient(180deg, #312E81 0%, #4F46E5 55%, #14B8A6 100%);
  color: #fff; padding: 24px 16px; position: fixed; top: 0; bottom: 0; overflow-y: auto;
  transition: left .25s ease; z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 20px; }
.sidebar-brand .logo-box {
  width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px;
}
.sidebar-brand div b { display: block; font-size: 15px; }
.sidebar-brand div span { font-size: 11px; opacity: 0.75; }

.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.85); margin-bottom: 2px;
  transition: background .15s;
}
.side-nav a:hover { background: rgba(255,255,255,0.12); }
.side-nav a.active { background: rgba(255,255,255,0.22); color: #fff; font-weight: 700; }
.side-nav .nav-icon { width: 20px; text-align: center; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: 0.9; }
.side-nav a:hover .nav-icon { opacity: 1; }
.side-nav a.active .nav-icon { opacity: 1; }
.side-nav .group-label { font-size: 11px; text-transform: uppercase; opacity: 0.55; margin: 18px 8px 6px; letter-spacing: .06em; }

.main-content { margin-left: 260px; flex: 1; padding: 24px 28px 60px; width: 100%; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px;
  background: var(--surface); padding: 14px 20px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 800; }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; }
.topbar .user-chip img, .topbar .user-chip .avatar-fallback {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--grad-3);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff;
}
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--primary); }

.card-nuhi { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 22px; }
.card-nuhi h2, .card-nuhi h3 { margin-top: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card { border-radius: var(--radius); padding: 20px; color: #fff; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card .stat-icon { font-size: 26px; opacity: 0.9; margin-bottom: 10px; }
.stat-card .stat-icon svg { width: 28px; height: 28px; stroke: #fff; opacity: 0.95; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; }
.stat-card .stat-label { font-size: 13px; opacity: 0.9; }
.stat-card.c1 { background: linear-gradient(135deg, #34D399, #059669); }
.stat-card.c2 { background: linear-gradient(135deg, #60A5FA, #4F46E5); }
.stat-card.c3 { background: linear-gradient(135deg, #FBBF24, #F59E0B); }
.stat-card.c4 { background: linear-gradient(135deg, #F472B6, #DB2777); }
.stat-card.c5 { background: linear-gradient(135deg, #5EEAD4, #0D9488); }

table.table-nuhi { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table-nuhi th { text-align: left; padding: 12px 14px; background: var(--bg); color: var(--text-muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.table-nuhi td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
table.table-nuhi tr:hover td { background: #FAFBFF; }

.badge-nuhi { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-nuhi.green { background: #DCFCE7; color: #15803D; }
.badge-nuhi.red { background: #FEE2E2; color: #B91C1C; }
.badge-nuhi.yellow { background: #FEF3C7; color: #B45309; }
.badge-nuhi.blue { background: #DBEAFE; color: #1D4ED8; }
.badge-nuhi.gray { background: #F1F5F9; color: #475569; }

.fab-scan {
  position: fixed; bottom: 26px; right: 26px; width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary)); color: #fff; border: none;
  font-size: 24px; box-shadow: 0 10px 26px rgba(79,70,229,0.4); cursor: pointer; z-index: 30;
}

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.5); z-index: 100;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius); padding: 26px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-box h3 { margin-top: 0; }
.modal-close { float: right; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }

.face-scan-box { position: relative; width: 100%; max-width: 420px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; background: #000; }
.face-scan-box video, .face-scan-box canvas { width: 100%; display: block; }
.face-scan-frame { position: absolute; inset: 12%; border: 3px dashed rgba(255,255,255,0.7); border-radius: 20px; pointer-events: none; }
.face-toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(135deg, #34D399, #059669); color: #fff; padding: 14px 26px; border-radius: 14px;
  font-weight: 700; box-shadow: var(--shadow-lg); opacity: 0; transition: all .3s; z-index: 200;
}
.face-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .icon svg { width: 40px; height: 40px; stroke: var(--text-muted); }

@media (max-width: 900px) {
  .sidebar { left: -280px; }
  .sidebar.open { left: 0; }
  .main-content { margin-left: 0; padding: 18px 14px 80px; }
  .menu-toggle { display: block; }
}
