/* =====================================================================
   Tabungan Siswa v2 — gaya komponen (dipakai bersama Tailwind CDN)
   ===================================================================== */
:root {
  --emerald: #059669;
  --emerald-dark: #047857;
  --slate-200: #e2e8f0;
  --slate-500: #64748b;
}

html, body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

.safe-top { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.glass-card { background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* ---------- Form ---------- */
.lbl { display: block; font-size: 11px; font-weight: 700; color: #475569; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.lbl-xs { display: block; font-size: 10px; font-weight: 700; color: #475569; margin-bottom: 2px; }
.inp, .inp-sm {
  width: 100%; background: #f8fafc; border: 1px solid var(--slate-200); border-radius: 12px;
  font-size: 14px; font-weight: 500; color: #1e293b; outline: none; transition: box-shadow .15s, background .15s;
}
.inp { padding: 10px 12px; }
.inp-sm { width: auto; padding: 7px 10px; font-size: 12px; border-radius: 10px; }
.inp:focus, .inp-sm:focus { background: #fff; box-shadow: 0 0 0 2px var(--emerald); border-color: transparent; }
.inp:disabled { background: #f1f5f9; color: var(--slate-500); cursor: not-allowed; }
@media (max-width: 768px) { .inp, .inp-sm, select, textarea { font-size: 16px !important; } }  /* cegah zoom iOS */
.icon-left { position: absolute; top: 0; bottom: 0; left: 0; display: flex; align-items: center; padding-left: 14px; color: #94a3b8; pointer-events: none; }

/* ---------- Tombol ---------- */
.btn-primary, .btn-dark, .btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 700; border-radius: 12px; cursor: pointer; transition: background .15s, transform .1s, opacity .15s;
}
.btn-primary { background: var(--emerald); color: #fff; box-shadow: 0 4px 12px rgba(5, 150, 105, .25); }
.btn-primary:hover { background: var(--emerald-dark); }
.btn-dark { background: #1e293b; color: #fff; }
.btn-dark:hover { background: #0f172a; }
.btn-outline { background: #fff; color: var(--emerald-dark); border: 1px solid #a7f3d0; }
.btn-outline:hover { background: #ecfdf5; }
.btn-primary:active, .btn-dark:active, .btn-outline:active { transform: scale(.98); }
button:disabled, .is-offline .needs-online { opacity: .5; cursor: not-allowed !important; pointer-events: none; }
.icon-btn { display: inline-flex; align-items: center; padding: 8px 10px; color: var(--slate-500); border-radius: 12px; transition: background .15s, color .15s; }
.icon-btn:hover { background: #f1f5f9; color: #1e293b; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.mini-btn { padding: 4px 8px; border-radius: 8px; font-size: 11px; font-weight: 700; border: 1px solid; transition: background .15s; white-space: nowrap; }
.mini-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.mini-amber { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.mini-red { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.mini-green { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

/* ---------- Kartu ---------- */
.card { background: #fff; padding: 20px; border-radius: 18px; border: 1px solid var(--slate-200); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
@media (max-width: 640px) { .card { padding: 16px; } }
.card-title { font-size: 15px; font-weight: 700; color: #1e293b; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

.stat { border-radius: 18px; padding: 18px; color: #fff; display: flex; justify-content: space-between; align-items: flex-start; box-shadow: 0 6px 16px var(--tw-shadow-color, rgba(0,0,0,.1)); }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.stat-icon { width: 44px; height: 44px; background: rgba(255, 255, 255, .2); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }

.jenis-opt { display: flex; align-items: center; justify-content: center; padding: 12px; border-width: 1px; border-radius: 12px; cursor: pointer; font-size: 13px; font-weight: 700; user-select: none; transition: background .15s; }
.jenis-opt:has(input:checked) { box-shadow: 0 0 0 2px currentColor inset; }

/* ---------- Tabel ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.tbl { width: 100%; text-align: left; font-size: 12px; white-space: nowrap; border-collapse: separate; border-spacing: 0; }
.tbl thead th { background: #f1f5f9; color: #475569; text-transform: uppercase; font-weight: 700; padding: 10px 12px; font-size: 11px; }
.tbl thead th:first-child { border-radius: 10px 0 0 10px; }
.tbl thead th:last-child { border-radius: 0 10px 10px 0; }
.tbl tbody td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tbody tr:hover td { background: #f8fafc; }
.tbl tfoot td { padding: 10px 12px; font-weight: 800; background: #f8fafc; }
.tbl td.wrap { white-space: normal; min-width: 180px; max-width: 360px; }
.tbl .empty { text-align: center; color: #94a3b8; padding: 24px 12px; font-weight: 500; white-space: normal; }
.tr-pending td { opacity: .6; }
.tr-deleted td { color: #94a3b8; text-decoration: line-through; }
.tr-deleted td:last-child, .tr-deleted td:last-child * { text-decoration: none; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; }
.b-masuk { background: #d1fae5; color: #047857; }
.b-keluar { background: #ffe4e6; color: #be123c; }
.b-admin { background: #f3e8ff; color: #7e22ce; }
.b-petugas { background: #dbeafe; color: #1d4ed8; }
.b-siswa { background: #d1fae5; color: #047857; }
.b-grey { background: #f1f5f9; color: #475569; }
.b-amber { background: #fef3c7; color: #b45309; }
.b-red { background: #fee2e2; color: #b91c1c; }

/* ---------- Pager ---------- */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid #f1f5f9; font-size: 12px; }
.pager .info { color: var(--slate-500); font-weight: 600; font-size: 11px; }
.pager .ctrl { display: flex; align-items: center; gap: 6px; }
.pager button { padding: 6px 12px; background: #f1f5f9; color: #334155; font-weight: 700; border-radius: 8px; }
.pager button:hover:not(:disabled) { background: #e2e8f0; }
.pager .page { padding: 6px 10px; background: #ecfdf5; color: #065f46; font-weight: 800; border-radius: 8px; border: 1px solid #a7f3d0; font-size: 11px; }
.pager select { padding: 5px 6px; border: 1px solid var(--slate-200); border-radius: 8px; font-size: 12px; font-weight: 700; background: #f8fafc; }

/* ---------- Segmented / switch ---------- */
.seg { display: inline-flex; background: #f1f5f9; padding: 4px; border-radius: 12px; }
.seg-btn { padding: 6px 14px; border-radius: 9px; font-size: 12px; font-weight: 700; color: #475569; }
.seg-btn.active { background: #fff; color: var(--emerald-dark); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.switch { display: inline-flex; align-items: center; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch span { width: 42px; height: 24px; background: #cbd5e1; border-radius: 99px; position: relative; transition: background .2s; flex-shrink: 0; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--emerald); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ---------- Tab ---------- */
.tab-btn { padding: 10px 16px; font-weight: 700; border-radius: 12px; font-size: 12px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; border: 1px solid var(--slate-200); background: #fff; color: #475569; transition: background .15s; }
.tab-btn:hover { background: #f1f5f9; }
.tab-btn.active { background: var(--emerald); color: #fff; border-color: var(--emerald); box-shadow: 0 2px 6px rgba(5, 150, 105, .25); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(15, 23, 42, .6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 12px; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 18px; padding: 20px; width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); animation: pop .15s ease-out; }
.modal-box.wide { max-width: 680px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Toast ---------- */
.toast { pointer-events: auto; padding: 12px 14px; border-radius: 14px; font-size: 13px; font-weight: 700; display: flex; gap: 10px; align-items: flex-start; box-shadow: 0 10px 25px rgba(0, 0, 0, .15); animation: up .2s ease-out; }
.toast-success { background: #065f46; color: #fff; }
.toast-error { background: #b91c1c; color: #fff; }
.toast-info { background: #1e293b; color: #fff; }
@keyframes up { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Cetak ---------- */
#printableArea { display: none; }
@media print {
  @page { margin: 10mm 12mm; size: portrait; }
  html, body { background: #fff !important; color: #000 !important; height: auto !important; overflow: visible !important; }
  #app { display: none !important; }
  #printableArea { display: block !important; }
}

/* Kartu statistik ringkas di HP agar form input langsung terlihat */
@media (max-width: 640px) {
  .stat { padding: 10px; border-radius: 14px; }
  .stat-label { font-size: 8.5px; letter-spacing: 0; }
  .stat-value { font-size: 13px; margin-top: 3px; }
  .stat-icon { display: none; }
}
