:root {
  --primary: #1d4ed8; /*bingkai_teks*/
  --primary-dark: #1e3a8a; /*warna font*/
  --accent: #f59e0b;
  --bg: #f3f6f4;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #cbd5e1;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* HEADER */
header {
  background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
  color: #ffffff;
  padding: 1.6rem 2rem;
  border-bottom: 4px solid #f59e0b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.logo-box {
  width: 68px;
  height: 68px;
  background: #fff;
  color: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--accent);
  overflow: hidden;
  padding: 4px;
  flex-shrink: 0;
}

.logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.header-title h1 {
  font-size: 1.5rem;
  letter-spacing: 0.5px;
}

.header-title p {
  font-size: 0.9rem;
  color: #dbeafe;
}

/* NAVIGATION MENU */
nav {
  background: #fff;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
}

.nav-btn {
  padding: 1rem 1.5rem;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-btn:hover {
  color: var(--primary);
  background: #f8fafc;
}

.nav-btn.active {
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
  background: #ecfdf5;
}

/* MAIN CONTAINER */
main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.tab-section {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-section.active {
  display: block;
}

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

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 1.8rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
  border: 1px solid #e2e8f0;
}

.section-heading {
  font-size: 1.25rem;
  color: var(--primary-dark);
  margin-bottom: 0.3rem;
  border-left: 4px solid var(--accent);
  padding-left: 0.75rem;
}

.section-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.mb-0 {
  margin-bottom: 0;
}

.sub-heading {
  margin-bottom: 0.8rem;
  color: var(--primary);
  font-size: 1.05rem;
}

.mt-section {
  margin-top: 1.4rem;
}

/* TOOLBAR HEADER */
.toolbar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.3rem;
}

.toolbar-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

/* FORM GRID */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem 1.8rem;
  align-items: end;
}
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #334155;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 104, 72, 0.12);
}

/* DYNAMIC MUZAKKI LIST */
.muzakki-wrapper {
  background: #f8fafc;
  border: 1px dashed var(--border);
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.muzakki-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.muzakki-row input {
  flex: 1;
}

.helper-text {
  display: block;
  margin-top: 0.5rem;
  color: var(--muted);
}

/* INPUT WITH PREFIX / SUFFIX */
.input-addon {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.input-addon span {
  background: #f1f5f9;
  padding: 0.65rem 0.85rem;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
  border-right: 1px solid var(--border);
}

.input-addon.suffix span {
  border-right: none;
  border-left: 1px solid var(--border);
}

.input-addon input {
  border: none;
  width: 100%;
  border-radius: 0;
}

.input-addon input:focus {
  box-shadow: none;
}

/* BUTTONS */
.btn {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition:
    background 0.2s,
    transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-lg {
  font-size: 1rem;
  padding: 0.85rem 1.8rem;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-outline {
  background: #fff;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: #ecfdf5;
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
}

.btn-danger:hover {
  background: #fecaca;
}

/* SUMMARY BAR */
.summary-bar {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 1rem 1.4rem;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.summary-bar .total-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.total-sub {
  font-size: 0.9rem;
  color: var(--primary);
}

/* TABLES */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
}

tr:hover td {
  background: #f8fafc;
}

/* STAT CARDS & CHART */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.8rem;
}

.stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-top: 4px solid var(--primary);
  padding: 1.1rem;
  border-radius: 10px;
}

.stat-card.gold {
  border-top-color: var(--accent);
}

.stat-card h4 {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.stat-card .value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
}

.chart-title {
  margin: 1.5rem 0 0.8rem;
  color: var(--primary-dark);
}

.chart-box {
  margin-top: 1rem;
}

.bar-row {
  margin-bottom: 1rem;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.bar-track {
  width: 100%;
  height: 22px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #10b981);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* MODAL QRIS BARCODE */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 500px;
  min-height: 900px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 16px;
  padding: 20px 20px 18px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
.modal-title {
  color: var(--primary-dark);
  margin-bottom: 0.3rem;
}

.modal-subtitle {
  font-size: 0.88rem;
  color: var(--muted);
}

.qris-frame {
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 0.6rem;
  margin: 0.8rem auto;
  display: inline-block;
  background: #fff;
}

.qris-image {
  width: 380px;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.modal-detail-box {
  background: #f8fafc;
  padding: 0.8rem;
  border-radius: 8px;
  margin-bottom: 1.2rem;
  font-size: 0.92rem;
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* RECEIPT / KWITANSI */
.receipt-box {
  border: 2px solid #1e293b;
  padding: 2rem;
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px double #1e293b;
  padding-bottom: 1rem;
  margin-bottom: 1.2rem;
}

.receipt-table {
  margin-top: 0;
  margin-bottom: 1rem;
}

.receipt-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: none;
}

.receipt-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  font-size: 0.9rem;
  gap: 1rem;
}

.receipt-doa {
  max-width: 60%;
  font-style: italic;
  color: var(--muted);
}

.receipt-sign {
  text-align: center;
}

.sign-space {
  height: 45px;
}

@media print {
  body * {
    visibility: hidden;
  }
  #receipt-printable,
  #receipt-printable * {
    visibility: visible;
  }
  #receipt-printable {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: none;
  }
  .no-print {
    display: none !important;
  }
}

/* MODAL PEMBAYARAN 3 LANGKAH */
.pay-modal-card {
  background: #f4f6f9;
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  text-align: left;
  color: #1e293b;
}

.pay-topbar {
  background: #ffffff;
  padding: 0.95rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.02rem;
}

.pay-back-btn,
.pay-close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #1e293b;
  padding: 0.2rem 0.5rem;
}

.pay-stepper {
  background: #0b5ed7;
  color: #ffffff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.step-item {
  opacity: 0.65;
  font-weight: 500;
}

.step-item.active {
  opacity: 1;
  font-weight: 700;
}

.step-arrow {
  opacity: 0.7;
}

.pay-step-body {
  padding: 1rem;
}

.method-option {
  background: #ffffff;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.method-option:hover {
  border-color: #0b5ed7;
  box-shadow: 0 4px 12px rgba(11, 94, 215, 0.12);
}

.method-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.badge-bsi {
  background: #00a39d;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.badge-qris {
  background: #0f172a;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border-bottom: 3px solid #dc2626;
}

.method-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.method-sub {
  font-size: 0.8rem;
  color: #64748b;
}

.method-arrow {
  font-weight: 700;
  color: #64748b;
}

.pay-box-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.1rem;
  margin-bottom: 0.9rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.pay-label-muted {
  font-size: 0.83rem;
  color: #64748b;
}

.pay-big-amount {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0.25rem 0;
}

.pay-rincian-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.88rem;
}

.check-icon {
  color: #0b5ed7;
  font-weight: 800;
}

.step2-badge-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.4rem;
}

.pay-note-text {
  font-size: 0.83rem;
  color: #64748b;
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px solid #f1f5f9;
}

.btn-pay-blue {
  width: 100%;
  background: #0b5ed7;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 0.85rem;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.3rem;
}

.btn-pay-blue:hover {
  background: #094db1;
}

.status-line {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.status-pending {
  color: #d97706;
  font-weight: 700;
}

.countdown-box {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 10px;
  padding: 0.85rem;
  text-align: center;
  margin-bottom: 0.9rem;
}

.countdown-timer {
  font-size: 1.2rem;
  font-weight: 800;
  color: #1e3a8a;
  margin: 0.2rem 0;
}

.countdown-deadline {
  font-size: 0.78rem;
  color: #475569;
}

.copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.rek-number {
  font-size: 1.25rem;
  letter-spacing: 0.5px;
  color: #0f172a;
}

.btn-salin {
  background: #ffffff;
  border: 1px solid #10b981;
  color: #059669;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-salin:hover {
  background: #ecfdf5;
}

.btn-batal-text {
  width: 100%;
  background: none;
  border: none;
  color: #dc2626;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.6rem;
  cursor: pointer;
  margin-bottom: 0.3rem;
}

/* UPLOAD BUKTI BAYAR & STATUS TOMBOL NONAKTIF */
.upload-box {
  border: 1.5px dashed #94a3b8;
  background: #f8fafc;
}

.upload-title {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.upload-box input[type="file"] {
  width: 100%;
  font-size: 0.85rem;
  background: #ffffff;
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
}

.preview-bukti-thumb {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  object-fit: contain;
}

.btn-pay-blue:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  opacity: 0.75;
}

/* TOMBOL WHATSAPP */
.btn-wa {
  background: #25d366;
  color: #ffffff;
}

.btn-wa:hover {
  background: #1ebe5d;
}

/* TOMBOL LOGIN ADMIN DI HEADER */
.header-admin-box {
  margin-left: auto;
}

.btn-admin-login {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
}

.btn-admin-login:hover {
  background: #f1f5f9;
}

/* RINCIAN KOTAK MUZAKKI PER KATEGORI */
.muzakki-section-title {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  color: #0f172a;
}

.muzakki-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.muzakki-card {
  background: #f8fafc;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.muzakki-label {
  display: block;
  font-size: 0.82rem;
  color: #475569;
  font-weight: 600;
}

.muzakki-value {
  margin: 0.35rem 0 0;
  font-size: 1.4rem;
  color: #0f172a;
}

/* Warna Garis Atas Tiap Kategori */
.border-fitrah-beras {
  border-top: 4px solid #16a34a;
}
.border-fitrah-uang {
  border-top: 4px solid #0284c7;
}
.border-maal {
  border-top: 4px solid #0d9488;
}
.border-shadaqah {
  border-top: 4px solid #15803d;
}
.border-fidyah {
  border-top: 4px solid #d97706;
}
.border-infaq {
  border-top: 4px solid #2563eb;
}

/* Kotak Total Keseluruhan Muzakki */
.muzakki-card-total {
  background: #ecfdf5;
  padding: 1rem;
  border-radius: 10px;
  border: 1.5px solid #10b981;
  border-top: 4px solid #047857;
  grid-column: 1 / -1;
}

.muzakki-total-label {
  display: block;
  font-size: 0.85rem;
  color: #065f46;
  font-weight: 700;
}

.muzakki-total-value {
  margin: 0.35rem 0;
  font-size: 1.6rem;
  color: #064e3b;
}

.muzakki-total-split {
  font-size: 0.85rem;
  color: #047857;
  font-weight: 600;
}

.badge-beras,
.badge-tunai {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  color: #ffffff;
  font-weight: 800;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.badge-beras {
  background: #d97706;
}

.badge-tunai {
  background: #15803d;
}

/* Footer */
footer {
  margin-top: 30px;
  font-size: 10px;
  color: #7d7f81;
  padding: 10px;
  text-align: center;
  background: #cccecd;
}
.tab-section {
  display: none !important;
}
.tab-section.active {
  display: block !important;
}

/* Kunci tata letak 5 tombol navigasi agar stabil dan tidak melompat saat reload */
.nav-container {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  max-width: 100% !important;
  width: 100% !important;
  gap: 6px !important;
}

.nav-container .nav-btn {
  white-space: nowrap !important;
  padding: 18px 17px !important;
  font-size: 18px !important;
}
/* Merapikan tampilan header & menu navigasi di layar HP agar pas 100% */
@media (max-width: 768px) {
  html,
  body {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  #receipt-printable,
  .receipt-card {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: auto !important;
  }

  header,
  nav,
  .nav-container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .nav-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 6px !important;
    padding: 6px 10px !important;
    scrollbar-width: none;
  }

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

  .nav-container .nav-btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    padding: 9px 13px !important;
    font-size: 13px !important;
  }
}
