@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --accent: #06b6d4;
  --accent-light: #ecfeff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --violet: #7c3aed;
  --violet-light: #f5f3ff;
  --pink: #db2777;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 8px 24px -12px rgba(15,23,42,.12);
  --shadow-lg: 0 10px 40px -12px rgba(79,70,229,.35);
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }

/* ============ TOPBAR ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
}
.topbar .logo {
  display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text);
}
.topbar .logo .logo-mark {
  width: 38px; height: 38px; border-radius: 12px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-size: 18px; box-shadow: var(--shadow-lg);
}
.topbar .logo .logo-text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 1;
}
@media (max-width: 768px) {
  .topbar .logo-text { white-space: normal; line-height: 1.2; max-width: 40vw; }
}

/* ============ LINGKUP DATA (SUPERADMIN) ============ */
.scope-bar {
  background: linear-gradient(90deg, #eef2ff, #faf5ff);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
}
.scope-bar-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.scope-label { font-size: 13px; font-weight: 700; color: var(--text-muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.scope-bar select { max-width: 380px; }
.burger {
  display: none; width: 40px; height: 40px; border: 1px solid var(--border); background: #fff;
  border-radius: 10px; font-size: 18px; color: var(--text);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border: 1px solid var(--border); background: #fff;
  border-radius: 10px; display: grid; place-items: center; color: var(--text-muted); font-size: 16px;
}
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
}

/* ============ PROFILE DROPDOWN ============ */
.avatar-btn {
  display: flex; align-items: center; gap: 4px; background: none; border: none; cursor: pointer; padding: 0;
}
.avatar-btn .avatar { border: 2px solid #fff; box-shadow: var(--shadow); }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: var(--card);
  border-radius: 14px; box-shadow: 0 10px 40px rgba(15,23,42,.18); border: 1px solid var(--border);
  padding: 8px; z-index: 60; display: none; opacity: 0; transform: translateY(-6px); transition: all .18s ease;
}
.dropdown-menu.open { display: block; opacity: 1; transform: translateY(0); }
.dropdown-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); font-weight: 600; font-size: 14px; transition: background .15s;
}
.dropdown-item:hover { background: #f1f5f9; }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item i { width: 18px; text-align: center; }

/* ============ SIDEBAR ============ */
.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 264px; flex: none; background: var(--card); border-right: 1px solid var(--border);
  padding: 18px 14px; overflow-y: auto; position: sticky; top: 60px; height: calc(100vh - 60px);
}
.sidebar .group-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); margin: 18px 10px 8px;
}
.sidebar a.nav, .sidebar button.nav-group-toggle {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 12px;
  color: var(--text-muted); font-weight: 600; font-size: 14px; margin-bottom: 3px;
  transition: all .15s ease;
}
.sidebar a.nav i { width: 20px; text-align: center; font-size: 16px; }
.sidebar a.nav:hover { background: #f1f5f9; color: var(--text); }
.sidebar a.nav.active { background: var(--grad); color: #fff; box-shadow: var(--shadow-lg); }

/* Nav group expand/collapse */
.sidebar button.nav-group-toggle {
  width: 100%; background: none; border: none; cursor: pointer; text-align: left; justify-content: space-between;
}
.sidebar button.nav-group-toggle .group-label { margin: 0; }
.nav-group-arrow { transition: transform .2s ease; color: var(--text-muted); font-size: 12px; }
.nav-group.open .nav-group-arrow { transform: rotate(180deg); }
.nav-group-body { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.nav-group.open .nav-group-body { max-height: 600px; }
.nav-group-body a.nav { padding-left: 26px; font-size: 13.5px; }

/* ============ MAIN CONTENT ============ */
.main { flex: 1; min-width: 0; padding: 22px 22px 90px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title h1 { font-size: 22px; font-weight: 800; }
.page-title p { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }

/* ============ CARDS ============ */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px; border: 1px solid rgba(226,232,240,.6);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.card-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }

/* ============ STATS ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  border: 1px solid rgba(226,232,240,.6); position: relative; overflow: hidden;
}
.stat .stat-icon {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  font-size: 19px; margin-bottom: 12px;
}
.stat .stat-value { font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat .stat-label { color: var(--text-muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.stat.s1 .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat.s2 .stat-icon { background: var(--success-light); color: var(--success); }
.stat.s3 .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat.s4 .stat-icon { background: var(--accent-light); color: var(--accent); }
.stat.s5 .stat-icon { background: var(--violet-light); color: var(--violet); }
.stat.s6 .stat-icon { background: #fce7f3; color: var(--pink); }

/* ============ GRID ============ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: none; font-weight: 700; font-size: 14px;
  transition: all .15s ease; white-space: nowrap;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-lg); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f8fafc; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 7px; }
.form-group .hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-control {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 12px;
  background: #fff; color: var(--text); outline: none; transition: border .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }
.input-group { display: flex; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ============ ALERTS ============ */
.alert { padding: 13px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--accent-light); color: #155e75; border: 1px solid #a5f3fc; }

/* ============ BADGES ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--accent-light); color: var(--accent); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-violet { background: var(--violet-light); color: var(--violet); }
.badge-pink { background: #fce7f3; color: var(--pink); }
.badge-muted { background: #f1f5f9; color: var(--text-muted); }

/* ============ TABLE ============ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; min-width: 560px; background: #fff; }
.table th {
  text-align: left; padding: 13px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); background: #f8fafc; border-bottom: 1px solid var(--border); font-weight: 800;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbff; }
.table .num { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ============ NEWS / BLOG CARDS ============ */
.news-card { display: flex; flex-direction: column; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid rgba(226,232,240,.6); }
.news-card .thumb { height: 160px; object-fit: cover; width: 100%; background: linear-gradient(135deg,#eef2ff,#f5f3ff); }
.news-card .body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.news-card .judul { font-weight: 800; font-size: 15.5px; line-height: 1.4; margin-bottom: 6px; }
.news-card .excerpt { color: var(--text-muted); font-size: 13.5px; flex: 1; }
.news-card .meta { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--text-muted); }

/* ============ CALENDAR (12 blok) ============ */
.cal-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media (max-width: 760px) { .cal-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px) { .cal-grid { grid-template-columns: repeat(2, 1fr); } }
.cal-blok {
  border-radius: 14px; padding: 12px; text-align: center; border: 1.5px solid var(--border);
  font-weight: 700; transition: all .15s ease; cursor: default;
}
.cal-blok .b { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; opacity: .85; }
.cal-blok .v { font-size: 13px; margin-top: 3px; }
.cal-blok.lunas { background: var(--success-light); border-color: #86efac; color: #166534; }
.cal-blok.belum { background: #fdf2f8; border-color: #f9a8d4; color: #9d174d; }
.cal-blok.kosong { background: #fff; border-color: var(--border); color: var(--text-muted); }
.cal-blok.abu { background: #f1f5f9; border-color: #cbd5e1; color: #64748b; }
.cal-blok.tabungan { background: var(--accent-light); border-color: #67e8f9; color: #155e75; }

/* ============ PROGRESS ============ */
.progress { height: 10px; background: #eef2ff; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--grad); border-radius: 999px; transition: width .4s ease; }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); padding: 24px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }

/* ============ TABS ============ */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; }
.tab {
  padding: 9px 16px; border-radius: 999px; background: #fff; border: 1.5px solid var(--border);
  font-weight: 700; font-size: 13.5px; color: var(--text-muted); white-space: nowrap;
}
.tab.active { background: var(--grad); color: #fff; border-color: transparent; }

/* ============ TIMELINE / FEED ============ */
.feed { display: flex; flex-direction: column; gap: 14px; }
.feed-item { display: flex; gap: 14px; }
.feed-item .feed-dot { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 16px; }

/* ============ LOGIN PAGE ============ */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--grad); position: relative; overflow: hidden; }
.auth-wrap::before, .auth-wrap::after {
  content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); filter: blur(40px);
}
.auth-wrap::before { width: 420px; height: 420px; top: -120px; right: -100px; }
.auth-wrap::after { width: 380px; height: 380px; bottom: -120px; left: -100px; }
.auth-card { position: relative; width: 100%; max-width: 420px; background: #fff; border-radius: 24px; padding: 34px 30px; box-shadow: var(--shadow-lg); }
.auth-card .auth-logo { width: 58px; height: 58px; border-radius: 18px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 26px; margin-bottom: 18px; box-shadow: var(--shadow-lg); }
.auth-card h2 { font-size: 22px; font-weight: 800; }
.auth-card .sub { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--text-muted); }

/* ============ MISC ============ */
.empty {
  text-align: center; padding: 48px 20px; color: var(--text-muted);
}
.empty .empty-icon { font-size: 44px; margin-bottom: 10px; opacity: .6; }
.list-group { display: flex; flex-direction: column; gap: 10px; }
.list-group-item { display: flex; align-items: center; gap: 12px; padding: 13px 15px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; } .flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.text-muted { color: var(--text-muted); } .text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }
.text-center { text-align: center; } .text-right { text-align: right; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; } .fw-800 { font-weight: 800; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.list-style-none { list-style: none; }

/* chips untuk filter */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--border); font-size: 13px; font-weight: 700; color: var(--text-muted); cursor: pointer; }
.chip.active { background: var(--grad); color: #fff; border-color: transparent; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100%; z-index: 90; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .burger { display: grid; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 85; display: none; }
  .sidebar-backdrop.open { display: block; }
  .main { padding: 18px 16px 96px; }
  .page-title h1 { font-size: 19px; }
}

/* Bottom nav mobile */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
  background: rgba(255,255,255,.95); backdrop-filter: blur(12px); border-top: 1px solid var(--border);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--text-muted); padding: 5px 4px; border-radius: 10px; flex: 1; }
.bottom-nav a i { font-size: 18px; }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a.active i { transform: translateY(-2px); }
@media (max-width: 700px) { .bottom-nav { display: flex; } .hide-mobile { display: none !important; } }

/* Toast */
.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #fff; border-radius: 12px; padding: 13px 16px; box-shadow: var(--shadow-lg); border-left: 4px solid var(--primary); font-weight: 600; font-size: 14px; animation: toastIn .25s ease; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* QR display */
.qr-box { display: inline-block; padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: 14px; }
