/* ==========================================================
   GEMA — Perapihan tampilan mobile + komponen Cash/Transfer
   Dimuat setelah gema.css (portal) dan gema-admin.css (admin).
   ========================================================== */

/* ---------- Dasar mobile ---------- */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
img, canvas, svg { max-width: 100%; }
a, button { -webkit-tap-highlight-color: transparent; }
.gema-btn, .gema-mobile-nav a { touch-action: manipulation; }

/* ==========================================================
   DOCK NAVIGASI BAWAH (HP)
   Dulu menumpuk karena kelas g-mobile-only (display:block) menimpa display:flex.
   Sekarang dock selalu flex; hanya disembunyikan di layar >= 768px (gema.css).
   ========================================================== */
.gema-mobile-nav {
  display: flex; flex-direction: row; flex-wrap: nowrap; align-items: stretch; justify-content: space-between;
  gap: 2px; padding: 6px; height: auto; min-height: var(--g-nav-h);
}
.gema-mobile-nav a {
  position: relative; flex: 1 1 0; min-width: 0; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 2px; line-height: 1.1; text-align: center;
}
.gema-nav-ico { position: relative; display: inline-flex; align-items: center; justify-content: center; height: 22px; }
.gema-nav-lbl { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gema-nav-badge {
  position: absolute; top: -6px; right: -12px; min-width: 17px; height: 17px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--g-err); color: #fff; font-size: .62rem; font-weight: 800; line-height: 1;
  box-shadow: 0 0 0 2px var(--g-surface);
}
.gema-nav-badge-inline { position: static; margin-left: auto; box-shadow: none; }
.gema-mobile-nav a:active { background: var(--g-primary-light); }
.gema-mobile-nav a:focus-visible { outline: 3px solid var(--g-teal); outline-offset: -3px; }
@media (min-width: 768px) { .gema-mobile-nav { display: none !important; } }

/* Teks panjang (no. struk, nama, rekening) tidak boleh melebar keluar layar */
.gema-list-item > div:first-child { min-width: 0; flex: 1 1 auto; }
.gema-list-item strong, .gema-list-item span { overflow-wrap: anywhere; }
.gema-list-item span { display: block; margin-top: 2px; }
.gema-list-item .val { flex: 0 0 auto; text-align: right; }

/* ---------- Pil status ---------- */
.gema-pill { display: inline-block !important; margin-top: 6px !important; padding: 3px 10px; border-radius: 999px; font-size: .7rem !important; font-weight: 800; letter-spacing: .02em; }
.gema-pill-ok { background: var(--g-primary-light); color: var(--g-primary-dark) !important; }
.gema-pill-warn { background: #fef3c7; color: #92400e !important; }

/* ---------- Pilihan Cash / Transfer (profil nasabah) ---------- */
.gema-pay-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.gema-pay-opt { position: relative; cursor: pointer; display: block; }
.gema-pay-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.gema-pay-opt > span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  min-height: 104px; padding: 14px 8px; border: 2px solid var(--g-line); border-radius: var(--g-radius-sm);
  background: var(--g-surface-2); transition: border-color .2s, background .2s, box-shadow .2s;
}
.gema-pay-opt i { font-size: 1.5rem; color: var(--g-muted); transition: color .2s; }
.gema-pay-opt strong { font-size: .95rem; }
.gema-pay-opt small { font-size: .72rem; color: var(--g-muted); line-height: 1.3; }
.gema-pay-opt input:checked + span { border-color: var(--g-primary); background: var(--g-primary-light); box-shadow: 0 0 0 4px rgba(15, 159, 92, .14); }
.gema-pay-opt input:checked + span i { color: var(--g-primary); }
.gema-pay-opt input:focus-visible + span { outline: 3px solid var(--g-teal); outline-offset: 2px; }

/* ---------- Ringkasan pembayaran (petugas, saat input setoran) ---------- */
.gema-pay-box { border: 1px solid var(--g-line); border-radius: var(--g-radius-sm); padding: 14px; margin-bottom: 16px; background: var(--g-surface-2); }
.gema-pay-box.is-transfer { border-color: #f5a524; background: #fffbeb; }
.gema-pay-box.is-cash { border-color: var(--g-border); background: var(--g-primary-light); }
.gema-pay-box-head { display: flex; align-items: center; gap: 12px; }
.gema-pay-box-head > i { font-size: 1.4rem; color: var(--g-primary-dark); }
.gema-pay-box.is-transfer .gema-pay-box-head > i { color: #b45309; }
.gema-pay-box-head small { display: block; font-size: .7rem; color: var(--g-muted); font-weight: 600; }
.gema-pay-box-head strong { font-size: 1rem; letter-spacing: .02em; }
.gema-pay-rek { margin-top: 10px; display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .75); font-size: .8rem; color: var(--g-muted); overflow-wrap: anywhere; }
.gema-pay-rek strong { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 1.05rem; color: var(--g-text); letter-spacing: .06em; }
.gema-pay-warn { margin: 10px 0 0; font-size: .8rem; font-weight: 700; color: var(--g-err); }

/* ---------- Baris kategori & harga ---------- */
.gema-kategori-row { grid-template-columns: minmax(0, 1fr) minmax(96px, 120px); }
.gema-kategori-info strong { display: block; font-size: .88rem; overflow-wrap: anywhere; }
.gema-kategori-info small { display: block; margin-top: 2px; color: var(--g-muted); font-size: .76rem; }

/* ---------- Tombol kirim lengket di atas dock (input setoran) ---------- */
.gema-setoran-submit {
  position: sticky; bottom: calc(var(--g-nav-h) + var(--g-safe-b) + 22px); z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; margin-top: 8px;
  background: var(--g-glass); border: 1px solid var(--g-glass-line); border-radius: 22px;
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--g-shadow-lg);
}
.gema-setoran-total { flex: 1; min-width: 0; }
.gema-setoran-total small { display: block; font-size: .66rem; font-weight: 800; color: var(--g-muted); letter-spacing: .06em; }
.gema-setoran-total div { font-family: var(--g-display); font-size: 1.25rem; font-weight: 800; color: var(--g-primary-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gema-setoran-submit .gema-btn { flex: 0 0 auto; }
@media (min-width: 768px) { .gema-setoran-submit { bottom: 16px; } }

/* ---------- Tab filter, daftar blok, baris rekening ---------- */
.gema-tabs { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; }
.gema-tabs a { flex: 1 0 auto; text-align: center; padding: 10px 16px; border-radius: 999px; font-size: .82rem; font-weight: 700; color: var(--g-muted); background: var(--g-surface); border: 1px solid var(--g-line); white-space: nowrap; }
.gema-tabs a.active { background: var(--g-primary-light); color: var(--g-primary-dark); border-color: var(--g-border); }
.gema-list-block { display: block; }
.gema-list-link { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; text-decoration: none; color: inherit; }
.gema-list-main { min-width: 0; flex: 1; }
.gema-list-main strong { display: block; font-size: .92rem; }
.gema-list-main span { display: block; font-size: .78rem; color: var(--g-muted); overflow-wrap: anywhere; }
.gema-list-link .val { font-family: var(--g-display); font-weight: 800; color: var(--g-primary); white-space: nowrap; }
.gema-rek-line { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: var(--g-surface-2); font-size: .78rem; color: var(--g-muted); overflow-wrap: anywhere; }
.gema-rek-line i { margin-top: 2px; color: var(--g-primary); }
.gema-rek-line strong { color: var(--g-text); letter-spacing: .04em; }
.gema-list-block form { margin-top: 8px; }

/* ---------- Aksi beranda, filter, bar laporan ---------- */
.gema-action-stack { display: grid; gap: 10px; }
.gema-filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.gema-filter-row .gema-btn { grid-column: 1 / -1; }
.gema-filter-row .gema-field { margin-bottom: 0; }
@media (min-width: 768px) {
  .gema-filter-row { grid-template-columns: 1fr 1fr auto; }
  .gema-filter-row .gema-btn { grid-column: auto; }
}
.gema-bar-row { margin-bottom: 14px; }
.gema-bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: .84rem; margin-bottom: 6px; }
.gema-bar-head span { color: var(--g-muted); font-weight: 700; white-space: nowrap; }
.gema-bar { height: 10px; border-radius: 999px; background: var(--g-surface-2); overflow: hidden; }
.gema-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--g-primary), var(--g-teal)); }

/* ---------- HP kecil ---------- */
@media (max-width: 480px) {
  .gema-main { padding: 14px 12px; }
  .gema-card { padding: 16px; border-radius: 18px; }
  .gema-stat { padding: 16px 8px; }
  .gema-stat-num { font-size: 1.3rem; overflow-wrap: anywhere; }
  .gema-hdr { padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); border-radius: 0 0 22px 22px; }
  .gema-brand img { width: 36px; height: 36px; }
  .gema-brand strong { font-size: 1rem; }
  .gema-saldo-card { padding: 22px 20px; border-radius: 26px; }
  .gema-mobile-nav { left: 10px; right: 10px; }
  .gema-mobile-nav a { font-size: .6rem; }
  .gema-kartu-qr img { max-width: 180px; }
}
@media (max-width: 340px) {
  .gema-pay-opts { grid-template-columns: 1fr; }
}

/* Dock 5 menu (petugas) tetap muat di layar sempit */
@media (max-width: 360px) { .gema-mobile-nav a { font-size: .56rem; } .gema-mobile-nav { left: 8px; right: 8px; } }

/* ==========================================================
   SUPER ADMIN — responsif (tidak lagi khusus desktop)
   ========================================================== */
.ga-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.ga-filter .ga-field { margin-bottom: 0; min-width: 150px; }
.ga-panel { overflow-x: auto; }
.ga-panel .ga-table { min-width: 560px; }

@media (max-width: 1023px) {
  .ga-layout { display: block; }
  .ga-sidebar {
    position: sticky; top: 0; left: auto; bottom: auto; width: auto; z-index: 60;
    padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
    border-radius: 0 0 22px 22px; overflow: visible;
  }
  .ga-sidebar-brand { display: flex; align-items: baseline; gap: 10px; padding: 2px 4px 10px; margin-bottom: 8px; }
  .ga-sidebar-brand strong { font-size: 1.1rem; }
  .ga-sidebar nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .ga-sidebar nav::-webkit-scrollbar { display: none; }
  .ga-sidebar nav a { flex: 0 0 auto; white-space: nowrap; padding: 9px 14px; font-size: .82rem; margin: 0; }
  .ga-sidebar nav a:hover { transform: none; }
  .ga-main { margin-left: 0; padding: 18px 14px 40px; }
  .ga-topbar { margin-bottom: 18px; gap: 10px; flex-wrap: wrap; }
  .ga-topbar h1 { font-size: 1.4rem; }
  .ga-form-row { grid-template-columns: 1fr !important; }
  .ga-kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 560px) {
  .ga-kpi-grid { grid-template-columns: 1fr !important; }
  .ga-filter .ga-field { flex: 1 1 100%; }
  .ga-filter .ga-btn { flex: 1 1 100%; }
}

/* ---------- Logo SIGEMA ---------- */
.gema-login-box img.gema-login-logo { display: block; width: min(220px, 70%); height: auto; margin: 0 auto 4px; border-radius: 0; box-shadow: none; }
.ga-sidebar-logo { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 14px; padding: 4px; margin-bottom: 8px; }
@media (max-width: 1023px) { .ga-sidebar-logo { width: 32px; height: 32px; margin: 0; border-radius: 10px; padding: 3px; } }

/* ---------- Pembatalan setoran & referensi transfer ---------- */
.gema-pill-off { background: rgba(224, 54, 44, .12); color: var(--g-err) !important; }
.gema-list-link .val.is-void, .val.is-void { text-decoration: line-through; color: var(--g-muted) !important; }
.gema-ref-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.gema-ref-form input[type="text"] { flex: 1 1 180px; min-width: 0; margin: 0; }
.gema-ref-form .gema-btn { flex: 1 1 auto; }
details.gema-card > summary { list-style: none; }
details.gema-card > summary::-webkit-details-marker { display: none; }
.gema-tabs { scrollbar-width: none; }
.gema-tabs::-webkit-scrollbar { display: none; }
