:root {
  --brand: #6f5cff;
  --brand-2: #8a7bff;
  --brand-3: #5a4ad8;
  --bg: #f5f6fb;
  --card: #ffffff;
  --text: #1f2240;
  --muted: #6b7290;
  --border: #e7e9f2;
  --success: #1cb47a;
  --danger: #e0496b;
  --warning: #f0a830;
  --info: #4ea7ff;
  --shadow: 0 4px 14px rgba(40, 35, 90, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-3); }

/* ============== TOP BAR ============== */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand {
  font-weight: 800;
  font-size: 20px;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand .logo {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px;
}
.topbar .spacer { flex: 1; }
.topbar .user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border-radius: 20px;
  background: #f0eeff;
}
.topbar .user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ============== NAV ============== */
.nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 6px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  position: sticky;
  top: 53px;
  z-index: 49;
}
.nav .item {
  position: relative;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.nav .item:hover { background: #f1efff; color: var(--brand); }
.nav .item.active { background: #efecff; color: var(--brand); }
.nav .item .caret { font-size: 10px; opacity: .7; }
.nav .dropdown {
  position: absolute;
  top: 100%; left: 0;
  background: #fff;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  z-index: 60;
}
.nav .item:hover .dropdown { display: block; }
.nav .dropdown a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text);
}
.nav .dropdown a:hover { background: #f1efff; color: var(--brand); }
.nav .dropdown .dropdown-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--brand);
  font-weight: 700;
  padding: 10px 12px 4px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.nav .dropdown .dropdown-section:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 6px;
}

/* ============== HERO ============== */
.hero {
  background: linear-gradient(135deg, #7a69ff, #6a59ee 50%, #5a4ad8);
  color: #fff;
  padding: 28px 32px;
  border-radius: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hero h1 { margin: 0 0 4px; font-size: 22px; }
.hero p { margin: 0; opacity: .9; }
.breadcrumb { font-size: 13px; opacity: .9; }
.breadcrumb a { color: #fff; }

/* ============== CARDS / GRID ============== */
.container { padding: 20px 24px 60px; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 26px; font-weight: 800; margin: 6px 0; letter-spacing: -.5px; }
.card .meta { font-size: 12px; color: var(--muted); }
.card .icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.card.head-row { display: flex; justify-content: space-between; align-items: flex-start; }
.icon.purple { background: #efecff; color: var(--brand); }
.icon.green { background: #e3f6ed; color: var(--success); }
.icon.orange { background: #fff1de; color: var(--warning); }
.icon.blue { background: #e2efff; color: var(--info); }
.icon.red { background: #ffe5ec; color: var(--danger); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge.success { background: #e3f6ed; color: var(--success); }
.badge.warning { background: #fff1de; color: #b97a14; }
.badge.danger { background: #ffe5ec; color: var(--danger); }
.badge.info { background: #e2efff; color: #1d6fbf; }
.badge.muted { background: #eef0f6; color: var(--muted); }

/* ============== TABLE ============== */
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 0 0 12px; }
.section-title h2 { margin: 0; font-size: 16px; }

.table-wrap { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { background: #fafaff; font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .3px; }
.table tbody tr:hover { background: #fafaff; }
.table .text-right { text-align: right; }
.table .text-center { text-align: center; }
.table tfoot td { background: #fafaff; font-weight: 700; }

/* Header gelap (dipakai di laporan): override default light th */
.table tr.thead-dark th {
  background: #2b2f48;
  color: #fff;
  text-transform: none;
  font-size: 13px;
  letter-spacing: 0;
  font-weight: 600;
}
.table tr.thead-dark th small { text-transform: none; opacity: .75; font-weight: 400; font-size: 11px; }
.table tfoot tr.thead-dark td { background: #2b2f48; color: #fff; }

/* ============== FORMS / BUTTONS ============== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--brand); color: #fff;
  border: 0; cursor: pointer;
  font-weight: 600; font-size: 13px;
  text-decoration: none;
}
.btn:hover { background: var(--brand-3); color: #fff; }
.btn:disabled, .btn[disabled] { background: #c9cbd6; color: #fff; cursor: not-allowed; opacity: .7; }
.btn:disabled:hover { background: #c9cbd6; }
.btn.secondary { background: #eef0f6; color: var(--text); }
.btn.secondary:hover { background: #e1e3ed; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.outline { background: transparent; border: 1px solid var(--brand); color: var(--brand); }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.form-group label .req { color: var(--danger); }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(111, 92, 255, .15); }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.success { background: #e3f6ed; color: var(--success); }
.flash.error { background: #ffe5ec; color: var(--danger); }

/* ============== LOGIN ============== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6a59ee, #8a7bff);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: 16px;
  padding: 36px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.login-card .brand { font-size: 26px; justify-content: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; }

/* ============== UTIL ============== */
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-100 { width: 100%; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1; min-width: 200px; }

/* Filter row */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filter-row .form-group { margin-bottom: 0; }

/* ============== MJDialog (custom alert/confirm/prompt) ============== */
.mj-dlg-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 22, 50, .55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .15s ease;
  padding: 20px;
}
.mj-dlg-backdrop.open { opacity: 1; }
.mj-dlg {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.25);
  max-width: 440px;
  width: 100%;
  padding: 28px 26px 22px;
  text-align: center;
  transform: scale(.94);
  transition: transform .18s cubic-bezier(.2,.8,.2,1);
}
.mj-dlg-backdrop.open .mj-dlg { transform: scale(1); }
.mj-dlg-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
  margin: 0 auto 12px;
}
.mj-dlg-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 6px;
}
.mj-dlg-msg {
  font-size: 14px; color: var(--muted);
  margin-bottom: 18px;
  line-height: 1.5;
}
.mj-dlg-input {
  width: 100%; margin: 0 auto 18px;
  text-align: left;
}
.mj-dlg-actions {
  display: flex; gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.mj-dlg-actions .btn { min-width: 110px; justify-content: center; padding: 9px 16px; }
.mj-dlg-btn-primary { background: var(--brand); }
.mj-dlg-btn-primary:hover { background: var(--brand-3); }
.mj-dlg-btn-danger { background: var(--danger); }
.mj-dlg-btn-danger:hover { background: #b8364f; }

/* ============== CHOICES.JS THEME OVERRIDE ============== */
.choices { margin-bottom: 0; font-size: 14px; }
.choices__inner {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px 4px;
  min-height: 38px;
  font-size: 14px;
}
.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(111, 92, 255, .15);
}
.choices[data-type*="select-one"] .choices__inner { padding-bottom: 7px; }
.choices[data-type*="select-one"]::after {
  border-color: var(--muted) transparent transparent;
  right: 12px;
}
.choices__list--dropdown, .choices__list[aria-expanded] {
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 4px;
}
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background: #f1efff;
  color: var(--brand);
}
.choices__input {
  background: transparent;
  font-size: 14px;
  padding: 6px 8px;
}
.choices__placeholder { opacity: .55; }
.choices[data-type*="select-one"] .choices__button {
  display: none;
}
