:root {
  --kju-navy: #1B2A8A;
  --kju-navy-dark: #12206B;
  --kju-navy-light: #2D3FAA;
  --kju-red: #CC2929;
  --kju-red-light: #E03535;
  --kju-bg: #F0F2FB;
  --kju-sidebar-w: 260px;
  --kju-topbar-h: 60px;
}

/* ===== BASE ===== */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--kju-bg);
  color: #1e2a3a;
  font-size: 14px;
}

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--kju-sidebar-w);
  height: 100vh;
  background: var(--kju-navy);
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: transform .28s ease;
}
#sidebar .sidebar-brand {
  padding: 10px 16px;
  background: var(--kju-navy-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--kju-topbar-h);
  text-decoration: none;
}
#sidebar .sidebar-brand img {
  height: 44px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}
#sidebar .sidebar-brand-text {
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
}
#sidebar .sidebar-brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,.55);
  font-weight: 400;
}
#sidebar .nav-section {
  padding: 18px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.35);
}
#sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13.5px;
  border-radius: 0;
  transition: all .18s;
}
#sidebar .nav-link i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: .8;
}
#sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}
#sidebar .nav-link.active {
  color: #fff;
  background: var(--kju-red);
  font-weight: 600;
}
#sidebar .nav-link.active i { opacity: 1; }

/* ===== MAIN CONTENT ===== */
#main-content {
  margin-left: var(--kju-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== TOPBAR ===== */
#topbar {
  height: var(--kju-topbar-h);
  background: #fff;
  border-bottom: 1px solid #e5e9f5;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 900;
}
#topbar .page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--kju-navy);
  flex: 1;
}
#topbar .topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
}
#topbar .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--kju-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
#sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--kju-navy);
  cursor: pointer;
  padding: 4px;
}

/* ===== PAGE CONTENT ===== */
.page-content { padding: 24px; flex: 1; }

/* ===== STAT CARDS ===== */
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 2px 12px rgba(27,42,138,.07);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .18s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.navy { background: rgba(27,42,138,.12); color: var(--kju-navy); }
.stat-icon.red   { background: rgba(204,41,41,.12);  color: var(--kju-red); }
.stat-icon.green { background: rgba(34,197,94,.12);  color: #16a34a; }
.stat-icon.amber { background: rgba(245,158,11,.12); color: #d97706; }
.stat-val  { font-size: 22px; font-weight: 800; color: #1e2a3a; line-height: 1.1; }
.stat-label{ font-size: 12px; color: #7a8499; margin-top: 2px; }

/* ===== CARD ===== */
.kju-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(27,42,138,.07);
  overflow: hidden;
}
.kju-card .card-header {
  padding: 16px 20px;
  background: #fff;
  border-bottom: 1px solid #eef0f8;
  font-weight: 700;
  font-size: 14px;
  color: var(--kju-navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kju-card .card-body { padding: 20px; }

/* ===== TABLE ===== */
.kju-table { width: 100%; border-collapse: collapse; }
.kju-table thead th {
  background: #f5f7ff;
  color: var(--kju-navy);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 11px 14px;
  border-bottom: 2px solid #e5e9f5;
  white-space: nowrap;
}
.kju-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0f2fb;
  vertical-align: middle;
  font-size: 13.5px;
}
.kju-table tbody tr:hover { background: #f8f9ff; }
.kju-table tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge-piutang { background: #fef3c7; color: #92400e; font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.badge-lunas   { background: #d1fae5; color: #065f46; font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.badge-warning-exp { background: #fef3c7; color: #92400e; font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.badge-expired { background: #fee2e2; color: #991b1b; font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }

/* ===== BUTTONS ===== */
.btn-kju { background: var(--kju-navy); color: #fff; border: none; }
.btn-kju:hover { background: var(--kju-navy-dark); color: #fff; }
.btn-kju-red { background: var(--kju-red); color: #fff; border: none; }
.btn-kju-red:hover { background: #b91c1c; color: #fff; }

/* ===== LOGIN PAGE ===== */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--kju-navy) 0%, var(--kju-navy-light) 50%, var(--kju-red) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 60px; max-width: 100%; width: auto; object-fit: contain; }
.login-logo .login-title { font-size: 20px; font-weight: 800; color: var(--kju-navy); margin-top: 10px; }
.login-logo .login-sub { font-size: 12px; color: #888; }

/* ===== FORM ===== */
.form-label { font-weight: 600; font-size: 13px; color: #374151; }
.form-control, .form-select {
  border-radius: 8px;
  border-color: #dde1f0;
  font-size: 14px;
  padding: 9px 13px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--kju-navy);
  box-shadow: 0 0 0 3px rgba(27,42,138,.12);
}

/* ===== ALERT FLASH ===== */
.flash-alert {
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== EXPIRED / STOK ===== */
.stock-low { color: #dc2626; font-weight: 700; }
.stock-ok  { color: #16a34a; }
.ed-expired { color: #dc2626; }
.ed-near    { color: #d97706; }
.ed-ok      { color: #16a34a; }

/* ===== PRINT ===== */
@media print {
  #sidebar, #topbar, .no-print { display: none !important; }
  #main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: #fff !important; }
}

/* ===== MOBILE ===== */
@media (max-width: 991px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.show {
    transform: translateX(0);
  }
  #main-content {
    margin-left: 0;
  }
  #sidebar-toggle {
    display: block;
  }
  #sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
  }
  #sidebar-overlay.show {
    display: block;
  }
  #sidebar { z-index: 1000; }
  .page-content { padding: 16px; }
  .stat-val { font-size: 18px; }
}

/* ===== ABSENSI GPS ===== */
.gps-btn {
  width: 120px; height: 120px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  border: 4px solid;
  transition: all .3s;
}
.gps-btn.masuk { background: #d1fae5; border-color: #16a34a; color: #065f46; }
.gps-btn.keluar { background: #fee2e2; border-color: #dc2626; color: #991b1b; }
.gps-btn:hover { transform: scale(1.05); }
