/* ============================================================================
   ROUTERBOX SUITE — BILLING & TAGIHAN MANAGER STYLESHEET
   Supports Mobile & Desktop WinBox + Tema Terang (html[data-theme="light"]) & Gelap
   ============================================================================ */

.billing-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px 84px 12px;
  gap: 12px;
  background: #0b1120;
  color: #f8fafc;
}

/* 1. PROGRESS BAR TARGET PENAGIHAN */
.billing-progress-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.billing-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.billing-progress-title {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 6px;
}

.billing-progress-pct {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.billing-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.22);
  overflow: hidden;
}

.billing-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  transition: width 0.35s ease;
}

.billing-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #94a3b8;
  font-family: var(--font-mono, monospace);
}

/* 2. GRID 4 KARTU KPI KEUANGAN */
.billing-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.billing-kpi-card {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}

.billing-kpi-card:active {
  transform: scale(0.98);
}

.billing-kpi-card.active-filter {
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.billing-kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #94a3b8;
}

.billing-kpi-amount {
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  line-height: 1.25;
  margin-top: 2px;
}

.billing-kpi-count {
  font-size: 11.5px;
  font-weight: 700;
  color: #e2e8f0;
}

.billing-kpi-sub {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.billing-kpi-card.kpi-paid .billing-kpi-amount { color: #10b981; }
.billing-kpi-card.kpi-unpaid .billing-kpi-amount { color: #f59e0b; }
.billing-kpi-card.kpi-duetoday .billing-kpi-amount { color: #38bdf8; }
.billing-kpi-card.kpi-isolir .billing-kpi-amount { color: #ef4444; }

/* 3. TOOLBAR FILTER & PENCARIAN */
.billing-toolbar-card {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.billing-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #090d16;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 6px 10px;
}

.billing-search-row i {
  color: #64748b;
  font-size: 14px;
}

.billing-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: #f8fafc;
  font-size: 12.5px;
  font-family: inherit;
}

.billing-filters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.billing-select {
  width: 100%;
  padding: 7px 8px;
  border-radius: 9px;
  background: #090d16;
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  outline: none;
}

.billing-chips-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.billing-chips-scroll::-webkit-scrollbar {
  display: none;
}

.billing-chip {
  white-space: nowrap;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.billing-chip.active {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}

/* 4. KARTU TAGIHAN PELANGGAN */
.billing-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.billing-cust-card {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  position: relative;
  overflow: hidden;
  transition: all 0.15s ease;
}

.billing-cust-card.is-paid {
  border-left: 4px solid #10b981;
}

.billing-cust-card.is-unpaid {
  border-left: 4px solid #f59e0b;
}

.billing-cust-card.is-isolir {
  border-left: 4px solid #ef4444;
}

.billing-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.billing-cust-name {
  font-size: 14px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.25;
}

.billing-cust-sub {
  font-size: 11.5px;
  font-weight: 700;
  color: #38bdf8;
  font-family: var(--font-mono, monospace);
  margin-top: 2px;
}

.billing-badges-wrap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.billing-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2.5px 7px;
  border-radius: 6px;
  text-transform: uppercase;
}

.billing-badge.paid-cash {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.billing-badge.paid-online {
  background: rgba(2, 132, 199, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.billing-badge.unpaid {
  background: rgba(245, 158, 11, 0.16);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.billing-badge.isolir {
  background: rgba(239, 68, 68, 0.16);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.billing-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11.5px;
}

.billing-info-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.billing-info-lbl {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
}

.billing-info-val {
  font-weight: 700;
  color: #f1f5f9;
}

.billing-info-val.price {
  color: #10b981;
  font-family: var(--font-mono, monospace);
  font-size: 12.5px;
  font-weight: 800;
}

.billing-actions-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.billing-act-btn {
  flex: 1;
  min-width: 0;
  padding: 8px 8px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #1e293b;
  color: #f8fafc;
  transition: all 0.15s ease;
}

.billing-act-btn:active {
  transform: scale(0.97);
}

.billing-act-btn.pay {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-color: #059669;
  color: #ffffff;
  flex: 1.35;
}

.billing-act-btn.wa {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #16a34a;
}

.billing-act-btn.isolir-btn {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.billing-act-btn.unisolir-btn {
  background: rgba(2, 132, 199, 0.14);
  border-color: rgba(56, 189, 248, 0.35);
  color: #0284c7;
}

/* Pagination */
.billing-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

/* 5. MODAL KONFIRMASI BAYAR & MODAL REKAP KOLEKTOR/AREA */
.billing-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 11, 26, 0.72);
  backdrop-filter: blur(4px);
  z-index: 100050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.billing-modal-backdrop.show {
  display: flex;
}

.billing-modal-box {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  color: #f8fafc;
}

.billing-modal-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.billing-modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.billing-modal-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  display: flex;
  gap: 8px;
}

.billing-rekap-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.16);
  cursor: pointer;
}

.billing-rekap-item:hover {
  border-color: #38bdf8;
}

/* ============================================================================
   TEMA TERANG (LIGHT THEME) OVERRIDES UNTUK BILLING
   ============================================================================ */
html[data-theme="light"] .billing-root {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .billing-progress-card,
html[data-theme="light"] .billing-kpi-card,
html[data-theme="light"] .billing-toolbar-card,
html[data-theme="light"] .billing-cust-card,
html[data-theme="light"] .billing-pagination {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.05) !important;
  color: #0f172a !important;
}

html[data-theme="light"] .billing-progress-title,
html[data-theme="light"] .billing-kpi-count,
html[data-theme="light"] .billing-cust-name,
html[data-theme="light"] .billing-info-val {
  color: #0f172a !important;
}

html[data-theme="light"] .billing-progress-pct {
  background: #ecfdf5 !important;
  color: #059669 !important;
  border-color: #6ee7b7 !important;
}

html[data-theme="light"] .billing-kpi-card.kpi-paid .billing-kpi-amount { color: #059669 !important; }
html[data-theme="light"] .billing-kpi-card.kpi-unpaid .billing-kpi-amount { color: #d97706 !important; }
html[data-theme="light"] .billing-kpi-card.kpi-duetoday .billing-kpi-amount { color: #0284c7 !important; }
html[data-theme="light"] .billing-kpi-card.kpi-isolir .billing-kpi-amount { color: #dc2626 !important; }

html[data-theme="light"] .billing-search-row,
html[data-theme="light"] .billing-select {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .billing-search-input {
  color: #0f172a !important;
}

html[data-theme="light"] .billing-chip {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}

html[data-theme="light"] .billing-chip.active {
  background: #2563eb !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
}

html[data-theme="light"] .billing-cust-sub {
  color: #0284c7 !important;
}

html[data-theme="light"] .billing-info-grid {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] .billing-info-val.price {
  color: #059669 !important;
}

html[data-theme="light"] .billing-act-btn {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

html[data-theme="light"] .billing-act-btn.pay {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  border-color: #059669 !important;
  color: #ffffff !important;
}

html[data-theme="light"] .billing-act-btn.wa {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
  color: #15803d !important;
}

html[data-theme="light"] .billing-act-btn.isolir-btn {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #dc2626 !important;
}

html[data-theme="light"] .billing-act-btn.unisolir-btn {
  background: #f0f9ff !important;
  border-color: #7dd3fc !important;
  color: #0369a1 !important;
}

html[data-theme="light"] .billing-modal-box {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .billing-modal-footer {
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] .billing-rekap-item {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}
