:root{
  --bg1:#002eff;
  --bg2:#09ff82;
  --ink:#0f172a;
  --muted:#64748b;
  --card:#ffffff;
  --line:#e2e8f0;
  --primary:#0b4fe7;
  --primary2:#0bb4e7;
  --success:#16a34a;
  --danger:#dc2626;
  --warn:#f59e0b;
  --shadow:0 12px 30px rgba(2,6,23,.12);
  --r:16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*{box-sizing:border-box}
[hidden]{display:none !important}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color:var(--ink);
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
}

.page{
  min-height:100vh;
  padding:14px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.page-app{
  padding:0;
  display:block;
}

.card{
  background:var(--card);
  border:1px solid rgba(226,232,240,.9);
  border-radius:var(--r);
  box-shadow: var(--shadow);
}

.login-card{
  width:100%;
  max-width: 430px;
  padding:18px;
}

.login-header{margin-bottom:12px}
.brand{display:flex; gap:12px; align-items:center}
.brand-icon{
  width:48px;height:48px;
  display:grid;place-items:center;
  border-radius:14px;
  background: linear-gradient(135deg, rgba(11,79,231,.12), rgba(11,180,231,.18));
  font-size:22px;
}
.brand h1{margin:0; font-size:22px; letter-spacing:.2px}
.brand p{margin:2px 0 0; color:var(--muted); font-size:13px}

.hint{margin-top:14px; display:flex; gap:8px; align-items:center; color:var(--muted); font-size:13px}
.dot{width:10px;height:10px;border-radius:999px;background:#94a3b8; display:inline-block}

.form{display:flex; flex-direction:column; gap:12px}
.form-group{display:flex; flex-direction:column; gap:6px}
label{font-weight:650; font-size:13px; color:#334155}
.input, input[type="text"], input[type="password"], input[type="date"], input[type="number"], select{
  width:100%;
  padding:12px 12px;
  border:1.5px solid var(--line);
  border-radius:12px;
  font-size:15px;
  outline:none;
  background:#fff;
}
.input:focus, input:focus, select:focus{
  border-color: rgba(11,79,231,.6);
  box-shadow: 0 0 0 4px rgba(11,79,231,.12);
}

small.muted{color:var(--muted); font-size:12px; margin-top:4px}

.btn{
  border:0;
  border-radius: 12px;
  padding:12px 14px;
  font-weight:700;
  font-size:15px;
  cursor:pointer;
  background: linear-gradient(135deg, #0b4fe7, #0bb4e7);
  color:#fff;
  box-shadow: 0 8px 20px rgba(11,79,231,.25);
}
.btn:hover{filter:brightness(1.02)}
.btn:active{transform:translateY(1px)}
.btn-small{padding:10px 12px; font-size:13px; border-radius:12px}

.btn-primary{background: linear-gradient(135deg, #0b4fe7, #0bb4e7)}
.btn-success{background: linear-gradient(135deg, #22c55e, #16a34a)}
.btn-danger{background: linear-gradient(135deg, #ef4444, #b91c1c)}
.btn-ghost{background:#f1f5f9; color:#0f172a; box-shadow:none}

.alert{
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid var(--line);
  background:#f8fafc;
  color:#0f172a;
  font-size:13px;
}
.alert-error{border-color: rgba(220,38,38,.25); background: rgba(220,38,38,.08); color:#7f1d1d}
.alert-success{border-color: rgba(22,163,74,.25); background: rgba(22,163,74,.08); color:#14532d}

/* Admin tools layout */
.grid-two{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.card.inner{box-shadow:none; padding:14px; border-radius:14px}
@media(max-width:860px){.grid-two{grid-template-columns:1fr}}

/* App shell */
.appbar{
  position: sticky;
  top:0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(226,232,240,.9);
  padding:10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.appbar-left{display:flex; align-items:center; gap:10px; min-width:0}
.appbar-title{min-width:0}
.appbar-title .title{font-size:15px; font-weight:800; line-height:1.15; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.appbar-title .subtitle{font-size:12px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}

.appbar-right{display:flex; align-items:center; gap:8px}

.icon-btn{
  width:40px; height:40px;
  border-radius: 12px;
  border:1px solid rgba(226,232,240,.9);
  background:#fff;
  cursor:pointer;
  display:grid; place-items:center;
  font-size:18px;
}
.icon-btn.danger{border-color: rgba(220,38,38,.35); color: var(--danger)}

.status-chip{
  display:none; /* shown on >=360px */
  gap:8px;
  align-items:center;
  padding:8px 10px;
  border-radius: 999px;
  border:1px solid rgba(226,232,240,.9);
  background:#fff;
  font-size:12px;
  color:var(--muted);
}

.chip-btn{
  border:1px solid rgba(226,232,240,.9);
  background:#fff;
  border-radius: 999px;
  padding:8px 10px;
  font-size:12px;
  cursor:pointer;
}

@media (min-width: 360px){
  .status-chip{display:flex}
}

.content{
  padding: 14px;
  padding-bottom: calc(14px + 64px + var(--safe-bottom));
  max-width: 1200px;
  margin: 0 auto;
}

.loading{
  display:flex;
  align-items:center;
  gap:10px;
  margin: 8px 0 16px;
  padding: 10px 12px;
  border-radius: 14px;
  border:1px solid rgba(226,232,240,.9);
  background: rgba(255,255,255,.92);
}

.spinner{
  width:18px;height:18px;
  border-radius:999px;
  border:2px solid rgba(11,79,231,.25);
  border-top-color: rgba(11,79,231,.9);
  animation: spin .9s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}

.tabs{
  display:flex;
  gap:8px;
  background: rgba(255,255,255,.92);
  border:1px solid rgba(226,232,240,.9);
  border-radius: 999px;
  padding:6px;
  width:max-content;
  max-width:100%;
  overflow:auto;
  margin: 8px 0 12px;
}
.tab{
  border:0;
  border-radius: 999px;
  padding:10px 12px;
  background:transparent;
  cursor:pointer;
  font-weight:750;
  font-size:13px;
  color: var(--muted);
  white-space:nowrap;
}
.tab.active{
  background: linear-gradient(135deg, rgba(11,79,231,.12), rgba(11,180,231,.16));
  color:#0f172a;
}

.section{padding:14px}
.section-header{display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:12px}
.section-header h2{margin:0; font-size:16px}
.section-actions{display:flex; gap:8px; align-items:center}

.stats-grid{display:grid; grid-template-columns: 1fr; gap:10px}
.stat-card{
  padding:14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  border:1px solid rgba(226,232,240,.9);
}
.stat-card .kpi{color:var(--muted); font-size:12px; font-weight:750; letter-spacing:.3px; text-transform:uppercase}
.stat-card .value{font-size:22px; font-weight:900; margin-top:6px}
.stat-card .label{color:var(--muted); font-size:12px; margin-top:4px}

.currency{color:#14532d}
.currency.negative{color:#7f1d1d}

.filters{display:grid; grid-template-columns: 1fr; gap:10px; margin-bottom:12px}

.table-container{
  overflow:auto;
  border-radius: 14px;
  border:1px solid rgba(226,232,240,.9);
  background:#fff;
}

table{width:100%; border-collapse: collapse}
th{background: linear-gradient(135deg, #0b4fe7, #0bb4e7); color:#fff; padding:12px; font-size:13px; text-align:left; position:sticky; top:0}
td{padding:10px 12px; border-bottom:1px solid rgba(226,232,240,.9); font-size:13px}
tr:hover{background:#f8fafc}

.badge{
  background:#e2e8f0;
  color:#0f172a;
  padding:4px 8px;
  border-radius: 999px;
  font-size:12px;
  font-weight:700;
}

.action-buttons{display:flex; gap:6px; flex-wrap:wrap}
.btn-detail, .btn-edit, .btn-delete{
  border:0;
  border-radius: 10px;
  padding:8px 10px;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
  color:#fff;
}
.btn-detail{background: linear-gradient(135deg, #3b82f6, #2563eb)}
.btn-edit{background: linear-gradient(135deg, #f59e0b, #d97706)}
.btn-delete{background: linear-gradient(135deg, #ef4444, #b91c1c)}

.lembaga-cards{display:grid; grid-template-columns: 1fr; gap:10px}
.lembaga-card{
  background:#fff;
  border:1px solid rgba(226,232,240,.9);
  border-radius: 16px;
  padding:14px;
}
.lembaga-card h4{margin:0 0 10px; font-size:15px}
.lembaga-stats{display:grid; grid-template-columns: 1fr 1fr; gap:8px}
.lembaga-stat{background:#f8fafc; border:1px solid rgba(226,232,240,.9); border-radius: 14px; padding:10px; text-align:center}
.lembaga-stat .value{font-size:14px; font-weight:900; color:#0b4fe7}
.lembaga-stat .label{font-size:11px; color:var(--muted); margin-top:4px}

.center{text-align:center}

.callout{
  margin-top:12px;
  padding:12px;
  border-radius: 16px;
  border:1px dashed rgba(11,79,231,.35);
  background: rgba(11,79,231,.06);
  color:#0f172a;
  font-size:13px;
}

/* Mobile transaction cards */
.tx-cards{display:flex; flex-direction:column; gap:10px}
.tx-card{
  background:#fff;
  border:1px solid rgba(226,232,240,.9);
  border-radius: 16px;
  padding:12px;
}
.tx-top{display:flex; align-items:flex-start; justify-content:space-between; gap:10px}
.tx-title{font-weight:900; font-size:14px; margin:0}
.tx-sub{color:var(--muted); font-size:12px; margin-top:4px}
.tx-amount{font-weight:900; font-size:14px; text-align:right}
.tx-amount.negative{color:#7f1d1d}
.tx-amount.positive{color:#14532d}
.tx-meta{display:flex; gap:8px; flex-wrap:wrap; margin-top:10px}
.tx-actions{display:flex; gap:8px; margin-top:10px}
.tx-actions button{flex:1}

/* Modals */
.modal{display:none; position:fixed; inset:0; background: rgba(2,6,23,.55); z-index:100; padding: 14px}
.modal-content{
  width: min(900px, 100%);
  max-height: 86vh;
  overflow:auto;
  margin: 4vh auto 0;
  background:#fff;
  border-radius: 18px;
  padding: 14px;
  border:1px solid rgba(226,232,240,.9);
}
.modal-header{display:flex; justify-content:space-between; align-items:center; gap:10px; border-bottom:1px solid rgba(226,232,240,.9); padding-bottom:10px; margin-bottom:10px}
.modal-header h3{margin:0; font-size:16px}
.modal-subtitle{margin: 14px 0 10px; color:#0f172a}

.detail-grid{display:grid; grid-template-columns:1fr; gap:10px; margin-bottom:12px}
.detail-item{background:#f8fafc; border:1px solid rgba(226,232,240,.9); border-left:4px solid rgba(11,79,231,.65); border-radius: 14px; padding:10px}
.detail-label{font-weight:800; color:#334155; font-size:12px}
.detail-value{margin-top:4px; font-size:14px}

.row-actions{display:flex; gap:10px; justify-content:flex-end; margin-top: 10px}

.danger-box{margin:10px 0; padding:12px; border-radius: 16px; border-left:4px solid rgba(220,38,38,.75); background: rgba(220,38,38,.06)}
.danger-text{color:#7f1d1d; font-weight:800}

/* Bottom nav */
.bottom-nav{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 8px 10px;
  padding-bottom: calc(8px + var(--safe-bottom));
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-top:1px solid rgba(226,232,240,.9);
  display:flex;
  gap:8px;
  justify-content:space-between;
  z-index: 60;
}
.bottom-nav button{
  flex:1;
  border:1px solid rgba(226,232,240,.9);
  background:#fff;
  border-radius: 14px;
  padding:10px 8px;
  font-size:12px;
  font-weight:800;
  color: var(--muted);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.bottom-nav button.active{
  background: linear-gradient(135deg, rgba(11,79,231,.12), rgba(11,180,231,.16));
  color:#0f172a;
}

/* Floating Action Button */
.fab{
  position: fixed;
  right: 16px;
  bottom: calc(88px + var(--safe-bottom));
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border:0;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color:#fff;
  font-size:28px;
  font-weight:900;
  box-shadow: 0 16px 40px rgba(22,163,74,.28);
  z-index: 70;
  cursor:pointer;
}

/* Side nav */
.sidenav{
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: min(340px, 90vw);
  background: #fff;
  border-right:1px solid rgba(226,232,240,.9);
  z-index: 80;
  padding: 12px;
}
.sidenav-header{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px}
.sidenav-brand{display:flex; align-items:center; gap:10px}
.sidenav-title{font-weight:900}
.sidenav-sub{font-size:12px; color:var(--muted)}
.sidenav-nav{display:flex; flex-direction:column; gap:8px}
.sidenav-nav button{justify-content:flex-start}
.sidenav-footer{position:absolute; left:12px; right:12px; bottom:12px; color:var(--muted)}

.backdrop{
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,.45);
  z-index: 75;
}

/* Sheet */
.sheet{position: fixed; inset:0; z-index: 90; display:grid; align-items:end}
.sheet-content{
  width:100%;
  background:#fff;
  border-radius: 18px 18px 0 0;
  padding: 14px;
  border:1px solid rgba(226,232,240,.9);
}
.sheet-handle{width:44px;height:5px;border-radius:999px;background:#cbd5e1;margin:0 auto 10px}

/* Responsive enhancements */
@media (min-width: 640px){
  .page{padding:20px}
  .filters{grid-template-columns: repeat(4, 1fr)}
  .stats-grid{grid-template-columns: repeat(2, 1fr)}
  .lembaga-cards{grid-template-columns: repeat(2, 1fr)}
  .detail-grid{grid-template-columns: repeat(2, 1fr)}
  .grid-2{display:grid; grid-template-columns: 1fr 1fr; gap:12px}
}

@media (min-width: 980px){
  .content{padding-bottom: 14px}
  .bottom-nav{display:none !important}
  .only-mobile{display:none !important}
  .only-desktop{display:block !important}
  .stats-grid{grid-template-columns: repeat(4, 1fr)}
  .lembaga-cards{grid-template-columns: repeat(3, 1fr)}
}

/* default: mobile */
.only-desktop{display:none}


/* ---- Lampiran Bukti (Struk) ---- */
.toggle-row{display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:8px}
.toggle-inline{display:inline-flex; gap:8px; align-items:center; font-weight:650; font-size:13px; color:#334155}
.toggle-inline input{width:18px; height:18px}

.bukti-preview, .bukti-current{
  margin-top:10px;
  border:1px dashed var(--line);
  border-radius:14px;
  padding:10px;
  background:#f8fafc;
}
.bukti-preview img, .bukti-current img{
  width:100%;
  max-height:320px;
  object-fit:contain;
  border-radius:12px;
  border:1px solid rgba(226,232,240,.9);
  background:#fff;
}
.bukti-meta{margin-top:8px; color:var(--muted); font-size:12px}

/* ---- Admin: Manajemen Lembaga ---- */
.lembaga-admin-list{display:flex; flex-direction:column; gap:8px}
.lembaga-admin-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid rgba(226,232,240,.9);
  border-radius:14px;
  background:#fff;
}
.lembaga-admin-item .name{font-weight:750}
.lembaga-admin-item .actions{display:flex; gap:8px; flex-wrap:wrap}
