/* ===================================================================
   Sistem Pencatatan Keuangan Jamaah TQN
   Khusus Mobile Browser Android & Smartphone First
   - Anti-Horizontal Blowout (Strict Viewport 100vw)
   - Tabel List Jamaah Langsung Tampil di Paling Atas
   - Pentotalan Kas Ringkas di Bawah Tabel
   - Akses Admin Tersembunyi (/panel, #panel, Ikon Gembok Header)
   - Pemisahan Warna: Hijau = Tunai (Cash Fisik), Biru = Transfer (Bank)
   =================================================================== */

:root {
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Primary Islamic Theme Palette */
  --emerald-950: #022c22;
  --emerald-900: #064e3b;
  --emerald-800: #065f46;
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  --emerald-50:  #ecfdf5;

  /* PEMISAHAN METODE: TUNAI (HIJAU) */
  --color-tunai: #16a34a;
  --bg-tunai:    #ecfdf5;
  --border-tunai:#86efac;

  /* PEMISAHAN METODE: TRANSFER (BIRU) */
  --color-tf:    #0284c7;
  --bg-tf:       #f0f9ff;
  --border-tf:   #7dd3fc;

  /* Total, Peringatan & Emas */
  --gold-600:    #d97706;
  --gold-500:    #f59e0b;
  --gold-100:    #fef3c7;
  --gold-50:     #fffbeb;

  --red-600:     #dc2626;
  --red-100:     #fee2e2;
  --red-50:      #fef2f2;

  /* Neutrals */
  --slate-900:   #0f172a;
  --slate-800:   #1e293b;
  --slate-700:   #334155;
  --slate-600:   #475569;
  --slate-500:   #64748b;
  --slate-400:   #94a3b8;
  --slate-300:   #cbd5e1;
  --slate-200:   #e2e8f0;
  --slate-100:   #f1f5f9;
  --slate-50:    #f8fafc;
  --white:       #ffffff;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
}

/* ===================================================================
   RESET & STRICT MOBILE VIEWPORT
   Mencegah browser Android zoom-out / horizontal blowout
   =================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  font-size: 14px;
}

body {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-main);
  background-color: #f1f5f9;
  color: var(--slate-900);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Visibility Control Berdasarkan Role */
body.mode-user .admin-only {
  display: none !important;
}

body.mode-admin .admin-only {
  display: flex !important;
}

body.mode-admin button.admin-only,
body.mode-admin a.admin-only {
  display: inline-flex !important;
}

body.mode-admin section.admin-only {
  display: block !important;
}

/* ===================================================================
   ADMIN TOP BAR (Hanya Tampil Saat Admin Login)
   =================================================================== */
.admin-top-bar {
  background: linear-gradient(90deg, #92400e, #b45309, #d97706);
  color: #ffffff;
  padding: 6px 12px;
  font-size: 0.76rem;
  position: sticky;
  top: 0;
  z-index: 1001;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  width: 100%;
}

.admin-top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 100%;
}

.admin-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.admin-label svg {
  width: 14px;
  height: 14px;
}

.btn-logout {
  background: rgba(0, 0, 0, 0.28);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-weight: 600;
}

.btn-logout svg {
  width: 12px;
  height: 12px;
}

/* ===================================================================
   APP HEADER & NAVIGATION (MOBILE-FIRST & SLEEK)
   =================================================================== */
.app-header {
  background: linear-gradient(135deg, var(--emerald-900) 0%, var(--emerald-800) 65%, #033f30 100%);
  color: var(--white);
  box-shadow: 0 2px 10px rgba(6, 78, 59, 0.25);
  position: sticky;
  top: 0;
  z-index: 999;
  width: 100%;
}

.header-inner {
  padding: 10px 12px 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.brand-icon svg {
  width: 18px;
  height: 18px;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text p {
  font-size: 0.7rem;
  color: #a7f3d0;
  font-weight: 500;
  line-height: 1.1;
  margin-top: 1px;
  white-space: nowrap;
}

/* Ikon Gembok Rahasia (Discreet Admin Trigger di Header) */
.header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.btn-lock-trigger {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #d1fae5;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-lock-trigger:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.94);
}

.btn-lock-trigger svg {
  width: 15px;
  height: 15px;
}

/* SEGMENTED NAVIGATION BAR */
.segmented-nav {
  background: rgba(0, 0, 0, 0.18);
  padding: 4px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
}

.nav-track {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
}

.nav-track::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #a7f3d0;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.nav-btn svg {
  width: 14px;
  height: 14px;
}

.nav-btn.active {
  background: #ffffff;
  color: var(--emerald-900);
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

/* ===================================================================
   MAIN APP CONTENT & TAB WRAPPER
   =================================================================== */
.app-main {
  width: 100%;
  max-width: 100%;
  padding: 8px 8px 30px 8px;
  box-sizing: border-box;
}

.tab-content {
  display: none;
  width: 100%;
}

.tab-content.active {
  display: block;
  animation: fadeInTab 0.15s ease-out;
}

@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   FILTER & PERIODE CARD
   =================================================================== */
.filter-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  width: 100%;
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

@media (min-width: 480px) {
  .filter-row {
    flex-direction: row;
    align-items: center;
  }
  .select-box { flex: 1.3; }
  .search-box { flex: 1; }
}

.select-box, .search-box {
  position: relative;
  width: 100%;
}

.form-select {
  appearance: none;
  width: 100%;
  background-color: var(--white);
  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='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 13px;
  padding: 7px 28px 7px 9px;
  border: 1.5px solid var(--slate-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-800);
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--emerald-600);
}

.search-box {
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 9px;
  width: 14px;
  height: 14px;
  color: var(--slate-400);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 7px 26px 7px 28px;
  border: 1.5px solid var(--slate-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--slate-800);
}

.search-input:focus {
  outline: none;
  border-color: var(--emerald-600);
}

.clear-btn {
  position: absolute;
  right: 7px;
  background: none;
  border: none;
  color: var(--slate-400);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

/* Toolbar Sub & Legend */
.toolbar-sub {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--slate-100);
}

.legend-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  flex-wrap: wrap;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-tunai {
  background-color: var(--color-tunai);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.dot-tf {
  background-color: var(--color-tf);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.legend-sep {
  color: var(--slate-300);
}

.text-success { color: var(--color-tunai) !important; }
.text-blue    { color: var(--color-tf) !important; }
.text-gold    { color: var(--gold-600) !important; }
.text-danger  { color: var(--red-600) !important; }
.text-muted   { color: var(--slate-500) !important; }
.text-bold    { font-weight: 700 !important; }
.text-right   { text-align: right !important; }
.text-center  { text-align: center !important; }

/* Admin Inline Tools */
.admin-tools-row {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

/* Filter Chips (Kegiatan) */
.filter-chips {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chip-filter {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-600);
  cursor: pointer;
  white-space: nowrap;
}

.chip-filter.active {
  background: var(--emerald-800);
  border-color: var(--emerald-800);
  color: var(--white);
}

/* ===================================================================
   TABEL LIST JAMAAH (LANGSUNG TAMPIL DI PALING ATAS!)
   Strictly Contained Inside .table-scroll-wrapper
   =================================================================== */
.table-container-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  margin-bottom: 10px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.table-card-head {
  padding: 8px 10px;
  background: #fafbfc;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

.table-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.table-title h2 {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--slate-900);
}

.badge-periode, .badge-target {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.badge-periode {
  background: var(--emerald-50);
  color: var(--emerald-800);
  border: 1px solid var(--emerald-100);
}

.badge-target {
  background: var(--gold-50);
  color: var(--gold-600);
  border: 1px solid var(--gold-100);
}

.table-tip {
  font-size: 0.68rem;
  color: var(--slate-500);
  font-style: italic;
}

/* Table Scroll Wrapper: Wajib overflow-x auto & max-width 100% */
.table-scroll-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
  background: var(--white);
}

.mobile-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.75rem;
  background: var(--white);
}

.mobile-table thead th {
  background: #f1f5f9;
  color: var(--slate-700);
  font-weight: 700;
  font-size: 0.70rem;
  padding: 6px 4px;
  border-bottom: 2px solid var(--slate-300);
  border-right: 1px solid #e2e8f0;
  white-space: normal;
  text-align: left;
  vertical-align: middle;
  line-height: 1.15;
  position: sticky;
  top: 0;
  z-index: 5;
}

.mobile-table thead th:last-child {
  border-right: none;
}

.mobile-table tbody td {
  padding: 5px 4px;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f8fafc;
  vertical-align: middle;
  color: var(--slate-800);
  font-size: 0.74rem;
  line-height: 1.25;
}

.mobile-table tbody td:last-child {
  border-right: none;
}

.mobile-table tbody tr:nth-child(even) td {
  background-color: #fafbfc;
}

.mobile-table tbody tr:hover td {
  background-color: #f1f5f9;
}

/* Baris Total di Kaki Tabel */
.table-foot-total td {
  background: #f8fafc !important;
  border-top: 2px solid var(--slate-300) !important;
  border-bottom: none !important;
  padding: 6px 4px !important;
  font-weight: 700;
  color: var(--slate-900);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-emerald {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.badge-info {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.badge-gray {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

/* Currency Cell Styling */
.cell-currency-tunai {
  color: var(--color-tunai) !important;
  font-weight: 700;
  display: block;
  font-size: 0.74rem;
  white-space: nowrap;
}

.cell-currency-tf {
  color: var(--color-tf) !important;
  font-weight: 700;
  display: block;
  font-size: 0.74rem;
  white-space: nowrap;
}

.cell-currency-zero {
  color: var(--slate-400);
}

.badge-pill-tunai {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-tunai);
  border: 1px solid var(--border-tunai);
  color: var(--color-tunai);
  padding: 0px 4px;
  border-radius: 4px;
  font-size: 0.60rem;
  font-weight: 700;
  margin-top: 1px;
  line-height: 1.3;
}

.badge-pill-tf {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-tf);
  border: 1px solid var(--border-tf);
  color: var(--color-tf);
  padding: 0px 4px;
  border-radius: 4px;
  font-size: 0.60rem;
  font-weight: 700;
  margin-top: 1px;
  line-height: 1.3;
}

/* Ziarah History Chips Inside Table Cell */
.ziarah-history-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.ziarah-item-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
}

.ziarah-item-badge.badge-tunai {
  background: var(--bg-tunai);
  border: 1px solid var(--border-tunai);
  color: var(--color-tunai);
}

.ziarah-item-badge.badge-tf {
  background: var(--bg-tf);
  border: 1px solid var(--border-tf);
  color: var(--color-tf);
}

/* ===================================================================
   PENTOTALAN KAS (DI BAWAH TABEL)
   =================================================================== */
.totals-bottom-container {
  margin-top: 10px;
  margin-bottom: 16px;
  width: 100%;
}

.totals-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slate-700);
  margin-bottom: 6px;
  padding-left: 2px;
}

.totals-title svg {
  width: 15px;
  height: 15px;
  color: var(--emerald-800);
}

.totals-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  width: 100%;
}

@media (min-width: 480px) {
  .totals-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .totals-grid .card-grand {
    grid-column: span 2;
  }
  .totals-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.total-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--slate-200);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.total-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.total-card-icon svg {
  width: 20px;
  height: 20px;
}

.total-card-info {
  min-width: 0;
}

.total-card-name {
  font-size: 0.72rem;
  font-weight: 700;
  display: block;
}

.total-card h3, .total-card h2 {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 1px 0;
}

.total-card small {
  font-size: 0.68rem;
  color: var(--slate-500);
  display: block;
}

/* Card Themes */
.card-tunai {
  background: #f0fdf4;
  border-color: #86efac;
}

.card-tunai .total-card-icon {
  background: #16a34a;
  color: #ffffff;
}

.card-tunai h3 {
  color: #15803d;
}

.card-tf {
  background: #f0f9ff;
  border-color: #7dd3fc;
}

.card-tf .total-card-icon {
  background: #0284c7;
  color: #ffffff;
}

.card-tf h3 {
  color: #0369a1;
}

.card-grand {
  background: #fffbeb;
  border-color: #fde68a;
}

.card-grand .total-card-icon {
  background: #d97706;
  color: #ffffff;
}

.card-grand h3 {
  color: #b45309;
}

.card-danger {
  background: #fef2f2;
  border-color: #fecaca;
}

.card-danger .total-card-icon {
  background: #dc2626;
  color: #ffffff;
}

.card-danger h3 {
  color: #b91c1c;
}

.notice-pill {
  margin-top: 6px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.72rem;
  color: var(--slate-600);
  display: flex;
  align-items: center;
  gap: 6px;
}

.notice-pill svg {
  width: 14px;
  height: 14px;
  color: var(--emerald-600);
  flex-shrink: 0;
}

/* ===================================================================
   BUTTONS & FORM ELEMENTS
   =================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.72rem;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--emerald-800);
  color: var(--white);
}

.btn-primary:active {
  background: var(--emerald-900);
}

.btn-outline {
  background: var(--white);
  border-color: var(--slate-300);
  color: var(--slate-700);
}

.btn-outline-success {
  background: var(--bg-tunai);
  border-color: var(--border-tunai);
  color: var(--color-tunai);
}

.btn-outline-blue {
  background: var(--bg-tf);
  border-color: var(--border-tf);
  color: var(--color-tf);
}

.btn-danger-outline {
  background: var(--red-50);
  border-color: #fca5a5;
  color: var(--red-600);
}

.btn-success {
  background: var(--color-tunai);
  color: var(--white);
}

.btn-secondary {
  background: var(--slate-200);
  color: var(--slate-700);
}

.btn-ghost {
  background: transparent;
  color: var(--slate-500);
  border: 1px solid var(--slate-200);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--slate-400);
  cursor: pointer;
  line-height: 1;
}

.btn svg {
  width: 12px;
  height: 12px;
}

.form-group {
  margin-bottom: 8px;
}

.form-group label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 3px;
}

.required {
  color: var(--red-600);
}

.form-input {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px solid var(--slate-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--slate-900);
}

.form-input:focus {
  outline: none;
  border-color: var(--emerald-600);
}

.form-input-sm {
  padding: 5px 8px;
  font-size: 0.78rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.divider {
  border: none;
  border-top: 1px solid var(--slate-200);
  margin: 10px 0;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.section-heading {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--slate-800);
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-heading svg {
  width: 16px;
  height: 16px;
  color: var(--emerald-800);
}

/* ===================================================================
   MODALS & DIALOGS
   =================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--slate-300);
  animation: modalPop 0.18s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card.modal-sm {
  max-width: 380px;
}

.modal-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
}

.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--slate-900);
}

.modal-sub {
  font-size: 0.72rem;
  color: var(--slate-500);
  margin-top: 1px;
}

.modal-body {
  padding: 12px 14px;
}

.modal-footer {
  padding-top: 10px;
  border-top: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}

/* PIN Input */
.pin-input {
  font-size: 1.3rem !important;
  letter-spacing: 0.3em;
  padding: 8px !important;
}

/* Infaq Group Box */
.infaq-group-box {
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.group-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--slate-800);
  display: flex;
  align-items: center;
  gap: 5px;
}

.group-title svg {
  width: 14px;
  height: 14px;
  color: var(--emerald-800);
}

.method-toggle-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.method-chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--slate-300);
  background: var(--white);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
}

.method-chip input[type="radio"] {
  display: none;
}

.method-chip .chip-label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.method-chip.method-tunai input:checked + .chip-label {
  color: var(--color-tunai);
  font-weight: 700;
}

.method-chip.method-tunai:has(input:checked) {
  border-color: var(--color-tunai);
  background: var(--bg-tunai);
}

.method-chip.method-tf input:checked + .chip-label {
  color: var(--color-tf);
  font-weight: 700;
}

.method-chip.method-tf:has(input:checked) {
  border-color: var(--color-tf);
  background: var(--bg-tf);
}

.quick-chip-row {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.btn-qchip {
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--white);
  border: 1px solid var(--slate-300);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
}

.btn-qchip:active {
  background: var(--slate-100);
}

.btn-qchip.chip-lunas {
  background: var(--emerald-50);
  border-color: var(--emerald-500);
  color: var(--emerald-800);
}

/* Cicilan Modal Specifics */
.mini-summary-bar {
  display: flex;
  justify-content: space-between;
  background: #f1f5f9;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  margin-bottom: 8px;
}

.form-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: #1e40af;
  margin-bottom: 6px;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--red-600);
  font-size: 0.7rem;
  cursor: pointer;
  text-decoration: underline;
}

.history-box {
  margin-top: 10px;
  border-top: 1px solid var(--slate-200);
  padding-top: 8px;
}

.history-heading {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--slate-700);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 0.74rem;
}

.history-item-actions {
  display: flex;
  gap: 4px;
}

/* Import Zone */
.import-zone {
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  background: #f8fafc;
  margin-top: 6px;
  cursor: pointer;
}

.import-zone p {
  font-size: 0.76rem;
  color: var(--slate-500);
  margin: 6px 0;
}

.import-icon {
  width: 30px;
  height: 30px;
  color: var(--emerald-600);
  margin: 0 auto;
}

/* ===================================================================
   APP FOOTER (DISCREET /panel LINK)
   =================================================================== */
.app-footer {
  background: var(--white);
  border-top: 1px solid var(--slate-200);
  padding: 12px 14px;
  text-align: center;
  font-size: 0.74rem;
  color: var(--slate-500);
  width: 100%;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-link-panel {
  color: var(--slate-600);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  font-weight: 600;
  transition: all 0.15s ease;
}

.footer-link-panel:hover, .footer-link-panel:active {
  background: var(--emerald-50);
  color: var(--emerald-800);
}

/* ===================================================================
   TOAST NOTIFICATION
   =================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 90%;
  max-width: 340px;
  pointer-events: none;
}

.toast {
  background: var(--slate-900);
  color: #ffffff;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  animation: toastIn 0.2s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast svg {
  width: 16px;
  height: 16px;
  color: var(--emerald-500);
  flex-shrink: 0;
}
