/* ===================================================================
   PERPULUHAN PRO - LUXURY DARK DESIGN SYSTEM
   Curated Dark Palette, Glassmorphism, Micro-Animations & Modern Typography
   =================================================================== */

:root {
  /* Color Palette */
  --bg-base: #090d16;
  --bg-surface: #0f172a;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-input: rgba(15, 23, 42, 0.8);
  --bg-modal: rgba(15, 23, 42, 0.95);
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(99, 102, 241, 0.4);

  /* Primary Brand & Accents */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);

  --accent-gold: #f59e0b;
  --accent-gold-light: #fbbf24;
  --accent-gold-glow: rgba(245, 158, 11, 0.3);

  --accent-emerald: #10b981;
  --accent-emerald-light: #34d399;
  --accent-emerald-glow: rgba(16, 185, 129, 0.3);

  --accent-rose: #f43f5e;
  --accent-rose-light: #fb7185;
  --accent-rose-glow: rgba(244, 63, 94, 0.3);

  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-gold: #fde68a;

  /* Fonts */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px var(--primary-glow);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

/* Global Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  background-image: 
    radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.12) 0px, transparent 40%),
    radial-gradient(at 90% 20%, rgba(245, 158, 11, 0.08) 0px, transparent 45%),
    radial-gradient(at 50% 90%, rgba(16, 185, 129, 0.06) 0px, transparent 50%);
  background-attachment: fixed;
}

.font-mono {
  font-family: var(--font-mono);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* App Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Header & Navigation Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  gap: 1.25rem;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
}

.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: radial-gradient(circle at 35% 35%, #fbbf24 0%, #d97706 65%, #92400e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(251, 191, 36, 0.4);
  animation: logoGlowPulse 4s infinite ease-in-out;
}

@keyframes logoGlowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.45); }
  50% { box-shadow: 0 0 32px rgba(245, 158, 11, 0.75); }
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-accent {
  background: linear-gradient(90deg, #fbbf24, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-left: 2px;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Month Navigation Quick Selector */
.month-selector-bar {
  display: flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 4px;
}

.nav-arrow-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-arrow-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.month-dropdown {
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
}

.month-dropdown option {
  background: #0f172a;
  color: #ffffff;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(79, 70, 229, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

.tab-btn svg {
  stroke-width: 2.2;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.7);
  color: #ffffff;
  border: 1px solid var(--border-medium);
}
.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border-color: var(--border-medium);
}

.btn-install-app {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
  animation: pulseInstall 3s infinite ease-in-out;
}

.btn-install-app:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55) !important;
}

@keyframes pulseInstall {
  0%, 100% {
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  }
  50% {
    box-shadow: 0 4px 22px rgba(16, 185, 129, 0.65);
  }
}

/* Main Content Container */
.main-content {
  flex: 1;
  padding: 1.75rem 2rem 3rem 2rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* Tab Views */
.tab-view {
  display: none;
  animation: fadeIn 0.3s ease-out forwards;
}

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

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

/* Period Banner */
.period-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.period-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.period-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.banner-status {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-paid {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-pending {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose-light);
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.btn-pay-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--accent-emerald-glow);
  transition: all 0.2s ease;
}

.btn-pay-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-emerald-glow);
}

/* 6 KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.25rem;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: transparent;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.card-income {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.85) 0%, rgba(16, 185, 129, 0.12) 100%) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
}
.card-income:hover::before { background: var(--accent-emerald); box-shadow: 0 0 12px var(--accent-emerald); }

.card-tithe:hover::before { background: var(--accent-gold); box-shadow: 0 0 12px var(--accent-gold); }
.card-prev:hover::before { background: #94a3b8; }
.card-due:hover::before { background: var(--accent-rose); box-shadow: 0 0 12px var(--accent-rose); }
.card-paid:hover::before { background: var(--primary); box-shadow: 0 0 12px var(--primary); }

/* Hero Card: Sisa Akhir Berjalan */
.card-remaining {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.9) 0%, rgba(6, 182, 212, 0.18) 100%) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  box-shadow: 0 8px 30px rgba(6, 182, 212, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

.card-remaining::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: var(--radius-lg);
  pointer-events: none;
  box-shadow: inset 0 0 22px rgba(56, 189, 248, 0.12);
}

.card-remaining::before {
  background: linear-gradient(90deg, #06b6d4, #38bdf8);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.8);
}

.card-remaining:hover {
  transform: translateY(-4px) scale(1.015);
  border-color: rgba(56, 189, 248, 0.7) !important;
  box-shadow: 0 14px 40px rgba(6, 182, 212, 0.4) !important;
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.kpi-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.icon-income { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.icon-tithe { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); }
.icon-prev { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.icon-due { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.icon-paid { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.icon-remaining { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
  color: #ffffff;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.text-income { color: var(--accent-emerald-light); }
.text-tithe { color: var(--accent-gold-light); }
.text-prev { color: #cbd5e1; }
.text-due { color: var(--accent-rose-light); }
.text-paid { color: #818cf8; }
.text-remaining { color: #38bdf8; }

/* Split Grid for Perpuluhan View */
.content-split-grid {
  display: grid;
  grid-template-columns: 2.1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .content-split-grid {
    grid-template-columns: 1fr;
  }
}

/* Panel Card */
.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.badge-count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.85rem;
  gap: 0.5rem;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: #ffffff;
  width: 150px;
}

.search-box input::placeholder {
  color: var(--text-dim);
}

/* Quick Add Income Bar */
.quick-add-bar {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.6rem;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.input-field {
  display: flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  flex: 1;
  min-width: 140px;
}

.input-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.input-field input {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  width: 100%;
}

.currency-prefix {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 0.4rem;
}

.tithe-preview-field {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.3rem 0.75rem;
  min-width: 130px;
}

.preview-label {
  font-size: 0.65rem;
  color: var(--accent-gold);
  text-transform: uppercase;
  font-weight: 700;
}

.preview-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-gold-light);
}

.btn-add {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.btn-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Modern Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 0.75rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-medium);
}

.data-table td {
  padding: 0.85rem;
  font-size: 0.88rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.table-summary-row td {
  padding: 1rem 0.85rem;
  border-top: 1px solid var(--border-medium);
  border-bottom: none;
  font-size: 0.95rem;
}

/* Action Icon Buttons */
.row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-icon-action {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.btn-icon-action.delete:hover {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

/* Payments List */
.payment-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  max-height: 220px;
  overflow-y: auto;
}

.payment-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.payment-item-info {
  display: flex;
  flex-direction: column;
}

.payment-item-dest {
  font-weight: 700;
  font-size: 0.85rem;
  color: #ffffff;
}

.payment-item-date {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.payment-item-amount {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-emerald-light);
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Calculation Breakdown Card */
.calculation-breakdown-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: auto;
}

.breakdown-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.83rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.breakdown-row.highlight {
  font-weight: 600;
  color: #ffffff;
}

.breakdown-row.total-highlight {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
}

.breakdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.65rem 0;
}

/* ================= ANALYTICS TAB ================= */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.chart-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.chart-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
}

.sources-tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.source-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.source-tag:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.source-freq {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold-light);
  background: rgba(245, 158, 11, 0.15);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
}

/* ================= MODAL STYLES ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-body {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: #ffffff;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.form-hint {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.form-note-box {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-size: 0.8rem;
  color: #cbd5e1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  background: rgba(11, 15, 25, 0.5);
  border-top: 1px solid var(--border-subtle);
  gap: 0.75rem;
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

/* ================= TOAST NOTIFICATIONS ================= */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.error { border-color: rgba(244, 63, 94, 0.4); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ================= CHECKLIST PEMASUKAN RUTIN STYLES ================= */
.checklist-section {
  margin-bottom: 2rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.checklist-guide {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.checklist-summary-text {
  font-size: 0.92rem;
}

.font-bold {
  font-weight: 700;
}

/* ================= CALCULATION EXPLANATION CARD ================= */
.calc-explanation-card {
  margin-top: 1.5rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.calc-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.calc-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

.calc-subtitle {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calc-steps {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.calc-step-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  transition: background 0.2s ease;
  font-size: 0.82rem;
  list-style: none !important;
}

.calc-step-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.calc-step-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.step-badge {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-hero {
  background: rgba(56, 189, 248, 0.25) !important;
  color: #38bdf8 !important;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.step-label {
  color: var(--text-muted);
}

.calc-step-highlight {
  background: rgba(6, 182, 212, 0.1) !important;
  border: 1px solid rgba(6, 182, 212, 0.25);
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem !important;
}

/* ================= CHECKLIST PROGRESS BAR ================= */
.checklist-progress-card {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.1rem;
  margin-bottom: 1.25rem;
}

.progress-bar-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}

.progress-label-main {
  color: var(--text-muted);
  font-weight: 600;
}

.progress-percent-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
}

.progress-track-ambient {
  width: 100%;
  height: 8px;
  background: rgba(15, 23, 42, 0.85);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.progress-fill-glow {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ================= GLOWING CHECKLIST CARDS ================= */
.checklist-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 0.85rem;
}

.checklist-card {
  display: flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  gap: 0.85rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.checklist-card:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.checklist-card.checked {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14) 0%, rgba(6, 182, 212, 0.06) 100%) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.checklist-card.checked:hover {
  border-color: rgba(16, 185, 129, 0.8) !important;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3) !important;
  transform: translateY(-2px);
}

.checklist-checkbox-box {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 6px;
  border: 2px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: rgba(15, 23, 42, 0.6);
}

.checklist-card.checked .checklist-checkbox-box {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #ffffff;
}

.checklist-info-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.checklist-source-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

.checklist-card.checked .checklist-source-name {
  color: #ffffff;
}

.checklist-amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.15rem;
}

.checklist-amount-val {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.checklist-card.checked .checklist-amount-val {
  color: var(--accent-emerald-light);
  font-weight: 600;
}

.checklist-tithe-pill {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.12);
  padding: 0.05rem 0.35rem;
  border-radius: var(--radius-full);
}

.template-source-highlight {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  letter-spacing: 0.02em;
}

/* ================= MODERN GLOWING BUTTONS (NON-STIFF) ================= */
.btn-action-glow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  user-select: none;
}

.btn-action-glow:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.btn-action-glow:active {
  transform: translateY(1px) scale(0.98);
}

.btn-action-glow.btn-sm {
  padding: 0.45rem 0.95rem;
  font-size: 0.8rem;
  border-radius: 10px;
}

/* 1. Primary Glow (Indigo / Violet) */
.btn-primary-glow {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.btn-primary-glow:hover {
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.55);
}

/* 2. Pay Glow (Gold / Amber) */
.btn-pay-glow {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
  font-weight: 800;
}
.btn-pay-glow:hover {
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6);
  color: #000000;
}

/* 3. Submit Glow / Success (Emerald) */
.btn-submit-glow, .btn-success-glow {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}
.btn-submit-glow:hover, .btn-success-glow:hover {
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.55);
}

/* 4. Non-Routine Add Glow (Cyan / Sky) */
.btn-non-routine {
  background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
  font-size: 0.82rem;
  padding: 0.5rem 1rem;
}
.btn-non-routine:hover {
  box-shadow: 0 8px 22px rgba(6, 182, 212, 0.5);
}

/* 5. Cancel / Neutral Glow */
.btn-cancel-glow {
  background: rgba(30, 41, 59, 0.85);
  color: var(--text-muted);
  border-color: var(--border-medium);
}
.btn-cancel-glow:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* 6. Danger Outline */
.btn-danger-outline {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.4);
}
.btn-danger-outline:hover {
  background: rgba(244, 63, 94, 0.25);
  color: #ffffff;
}

/* 7. Secondary Glow */
.btn-secondary-glow {
  background: rgba(99, 102, 241, 0.15);
  color: #cbd5e1;
  border-color: rgba(99, 102, 241, 0.35);
}
.btn-secondary-glow:hover {
  background: rgba(99, 102, 241, 0.28);
  color: #ffffff;
}

/* ================= CHECKLIST CONTROLS & FILTER CHIPS ================= */
.header-tools-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.checklist-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.checklist-search-box {
  flex: 1;
  min-width: 260px;
  max-width: 450px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  padding: 0.5rem 1rem;
}

.checklist-search-box input {
  width: 100%;
  font-size: 0.88rem;
}

.filter-chips-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
}

.filter-chip {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.filter-chip.active {
  background: rgba(99, 102, 241, 0.25);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
}

/* ================= BADGES & ITEM CATEGORIES ================= */
.badge-item-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-rutin {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-non-rutin {
  background: rgba(6, 182, 212, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

/* ================= USER MENU IN HEADER ================= */
.user-header-menu {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-subtle);
}

.btn-user-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.85rem 0.35rem 0.45rem;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-user-profile:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(99, 102, 241, 0.4);
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  position: relative;
}

.online-indicator-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  border: 1.5px solid #0f172a;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.75; }
}

.username-text {
  font-size: 0.82rem;
  font-weight: 700;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-danger-icon {
  background: rgba(244, 63, 94, 0.15) !important;
  color: #fb7185 !important;
  border: 1px solid rgba(244, 63, 94, 0.35) !important;
  border-radius: 50% !important;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.25s ease !important;
  text-decoration: none !important;
  flex-shrink: 0;
  box-sizing: border-box !important;
}

.btn-danger-icon svg {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  stroke: #fb7185 !important;
  stroke-width: 2.2 !important;
  display: block !important;
  transition: all 0.25s ease !important;
}

.btn-danger-icon:hover {
  background: rgba(244, 63, 94, 0.35) !important;
  border-color: rgba(244, 63, 94, 0.75) !important;
  box-shadow: 0 0 14px rgba(244, 63, 94, 0.5) !important;
  transform: scale(1.08) !important;
}

.btn-danger-icon:hover svg {
  stroke: #ffffff !important;
  transform: scale(1.08);
}

/* ================= MASTER TEMPLATE MANAGER ================= */
.modal-large {
  max-width: 780px;
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
  line-height: 1.4;
}

.template-manager-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.template-table-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.86rem;
  box-sizing: border-box;
}

.template-table-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.25rem 0;
}
/* ================= COMPREHENSIVE RESPONSIVE DESIGN (MOBILE & TABLET) ================= */

@media (max-width: 1024px) {
  .app-header {
    display: grid !important;
    grid-template-areas:
      "logo user"
      "month tabs"
      "actions actions";
    grid-template-columns: 1fr auto;
    row-gap: 0.75rem;
    column-gap: 0.75rem;
    padding: 0.85rem 1.25rem !important;
  }

  .brand-logo {
    grid-area: logo;
  }

  .user-header-menu {
    grid-area: user;
    margin-left: 0 !important;
    padding-left: 0 !important;
    border-left: none !important;
    justify-self: end;
  }

  .month-selector-bar {
    grid-area: month;
    width: 100%;
    justify-content: space-between;
  }

  .nav-tabs {
    grid-area: tabs;
    width: 100%;
    justify-content: center;
  }

  .tab-btn {
    flex: 1;
    justify-content: center;
    text-align: center;
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .header-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin-left: 0 !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .header-actions .action-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
  }

  .content-split-grid {
    grid-template-columns: 1fr !important;
  }

  .charts-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .app-header {
    grid-template-areas:
      "logo user"
      "month month"
      "tabs tabs"
      "actions actions";
    grid-template-columns: 1fr auto;
    row-gap: 0.55rem;
    padding: 0.75rem 0.85rem !important;
  }

  .month-selector-bar {
    width: 100%;
    justify-content: space-between;
  }

  .month-dropdown {
    font-size: 0.85rem;
  }

  .nav-tabs {
    width: 100%;
    display: flex;
  }

  .tab-btn {
    padding: 0.45rem 0.35rem;
    font-size: 0.76rem;
  }

  .tab-btn span {
    font-size: 0.76rem;
  }

  .main-content {
    padding: 1rem 0.75rem 3rem 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .period-banner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
    margin-bottom: 1.25rem !important;
  }

  .period-title {
    font-size: 1.45rem !important;
  }

  .banner-status {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  .btn-pay-glow {
    flex: 1 !important;
    justify-content: center !important;
    font-size: 0.82rem !important;
    padding: 0.5rem 0.75rem !important;
  }

  /* Mobile 2-Column KPI Cards (Fintech Banking Style) */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
    margin-bottom: 1.5rem !important;
  }

  .kpi-card {
    padding: 0.85rem 0.75rem !important;
    border-radius: var(--radius-md) !important;
  }

  .kpi-label {
    font-size: 0.68rem !important;
  }

  .kpi-value {
    font-size: 1.1rem !important;
    letter-spacing: -0.02em !important;
  }

  .kpi-subtext {
    font-size: 0.65rem !important;
  }

  .kpi-icon-wrap {
    width: 30px !important;
    height: 30px !important;
    font-size: 0.9rem !important;
  }

  /* Checklist Section Mobile */
  .panel-card {
    padding: 1rem 0.85rem !important;
    border-radius: var(--radius-md) !important;
  }

  .panel-title {
    font-size: 1.05rem !important;
  }

  .checklist-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
    width: 100% !important;
  }

  .checklist-card {
    padding: 0.75rem 0.85rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .checklist-controls-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
  }

  .checklist-search-box {
    width: 100% !important;
  }

  .checklist-search-box input {
    width: 100% !important;
  }

  .filter-chips-group {
    width: 100% !important;
    display: flex !important;
    gap: 0.35rem !important;
  }

  .filter-chip {
    flex: 1 !important;
    text-align: center !important;
    padding: 0.4rem 0.35rem !important;
    font-size: 0.72rem !important;
  }

  /* Quick Add Income Bar Mobile */
  .quick-add-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.55rem !important;
    padding: 0.65rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .input-field, .tithe-preview-field, #btn-submit-income {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  #btn-submit-income {
    justify-content: center !important;
  }

  .panel-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.65rem !important;
  }

  .panel-actions {
    width: 100% !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .panel-actions .search-box, .btn-non-routine {
    width: 100% !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .panel-actions .search-box input {
    width: 100% !important;
  }

  /* Prevent any grid/panel blowout */
  .content-split-grid,
  .panel-card,
  .panel-income-items,
  .panel-payments,
  .table-responsive {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .table-responsive {
    overflow: visible !important;
    margin-bottom: 0.5rem !important;
  }

  /* Table-to-Cards Transformation for Income Table on Mobile (Rock-Solid CSS Grid) */
  #table-income-items thead {
    display: none !important;
  }

  #table-income-items,
  #table-income-items tbody {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  #table-income-items tbody tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    row-gap: 0.5rem !important;
    column-gap: 0.55rem !important;
    align-items: center !important;
    background: rgba(30, 41, 59, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.85rem 0.95rem !important;
    margin-bottom: 0.65rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* TD 1: # Index -> Hide on mobile cards */
  #table-income-items tbody tr td:nth-child(1) {
    display: none !important;
  }

  /* TD 2: Sumber Pemasukan -> Row 1, Col 1 */
  #table-income-items tbody tr td:nth-child(2) {
    grid-column: 1 / 2 !important;
    grid-row: 1 !important;
    padding: 0 !important;
    border: none !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  #table-income-items tbody tr td:nth-child(2) strong {
    color: #ffffff !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    display: block !important;
    line-height: 1.25 !important;
    word-break: break-word !important;
  }
  #table-income-items tbody tr td:nth-child(2) small {
    display: block !important;
    color: var(--text-dim) !important;
    font-size: 0.72rem !important;
    margin-top: 0.15rem !important;
  }

  /* TD 3: Badge Rutin / Non-Rutin -> Row 1, Col 2 */
  #table-income-items tbody tr td:nth-child(3) {
    grid-column: 2 / 3 !important;
    grid-row: 1 !important;
    padding: 0 !important;
    border: none !important;
  }
  #table-income-items tbody tr td:nth-child(3) .badge-item-tag {
    font-size: 0.68rem !important;
    padding: 0.15rem 0.45rem !important;
    white-space: nowrap !important;
  }

  /* TD 4: Masuk (Amount) -> Row 1, Col 3 in bold emerald */
  #table-income-items tbody tr td:nth-child(4) {
    grid-column: 3 / 4 !important;
    grid-row: 1 !important;
    padding: 0 !important;
    border: none !important;
    text-align: right !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: var(--accent-emerald-light) !important;
    white-space: nowrap !important;
  }

  /* TD 5: Tithe 10% -> Row 2, spans Col 1 & 2 */
  #table-income-items tbody tr td:nth-child(5) {
    grid-column: 1 / 3 !important;
    grid-row: 2 !important;
    padding: 0.45rem 0 0 0 !important;
    border: none !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
    text-align: left !important;
    font-size: 0.85rem !important;
    color: var(--accent-gold-light) !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
  }
  #table-income-items tbody tr td:nth-child(5)::before {
    content: "Tithe 10%: ";
    color: var(--text-dim) !important;
    font-size: 0.72rem !important;
    font-weight: 500 !important;
  }

  /* TD 6: Action Buttons -> Row 2, Col 3 */
  #table-income-items tbody tr td:nth-child(6) {
    grid-column: 3 / 4 !important;
    grid-row: 2 !important;
    padding: 0.45rem 0 0 0 !important;
    border: none !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
    text-align: right !important;
  }
  #table-income-items tbody tr td:nth-child(6) .row-actions {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 0.4rem !important;
  }
  #table-income-items tbody tr td:nth-child(6) .btn-icon-action {
    width: 28px !important;
    height: 28px !important;
  }

  /* Empty State for Income Table */
  #table-income-items tbody tr:has(td.empty-state) {
    display: block !important;
    background: rgba(30, 41, 59, 0.25) !important;
    border: 1px dashed rgba(255, 255, 255, 0.1) !important;
  }
  #table-income-items tbody tr td.empty-state {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 1.25rem 0.75rem !important;
    border: none !important;
    color: var(--text-dim) !important;
    font-size: 0.85rem !important;
  }

  /* Table Footer (Totals) on Mobile - Stately Card */
  #table-income-items tfoot,
  #table-income-items tfoot tr,
  #table-income-items tfoot td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  #table-income-items tfoot tr {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.45rem !important;
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.85rem 1rem !important;
    margin-top: 0.75rem !important;
  }
  #table-income-items tfoot tr td:nth-child(1) {
    display: none !important;
  }
  #table-income-items tfoot tr td:nth-child(2) {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 0 0.45rem 0 !important;
    border: none !important;
    font-size: 1.02rem !important;
    font-weight: 700 !important;
  }
  #table-income-items tfoot tr td:nth-child(2)::before {
    content: "Total Pemasukan Bulan Ini:";
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    font-weight: 600 !important;
  }
  #table-income-items tfoot tr td:nth-child(3) {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.45rem 0 0 0 !important;
    border: none !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
    font-size: 1.02rem !important;
    font-weight: 700 !important;
  }
  #table-income-items tfoot tr td:nth-child(3)::before {
    content: "Total Tithe (10%):";
    font-size: 0.8rem !important;
    color: var(--accent-gold-light) !important;
    font-weight: 600 !important;
  }
  #table-income-items tfoot tr td:nth-child(4) {
    display: none !important;
  }

  /* Table-to-Cards Transformation for Payments Table on Mobile (Rock-Solid CSS Grid) */
  #table-payments thead {
    display: none !important;
  }

  #table-payments,
  #table-payments tbody {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  #table-payments tbody tr:not(:has(.empty-state)) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    row-gap: 0.45rem !important;
    column-gap: 0.6rem !important;
    align-items: center !important;
    background: rgba(30, 41, 59, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.85rem 0.95rem !important;
    margin-bottom: 0.65rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Destination -> Row 1, Col 1 */
  #table-payments tbody tr td:nth-child(2) {
    grid-column: 1 / 2 !important;
    grid-row: 1 !important;
    padding: 0 !important;
    border: none !important;
    min-width: 0 !important;
  }
  #table-payments tbody tr td:nth-child(2) strong {
    color: #ffffff !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    display: block !important;
  }
  #table-payments tbody tr td:nth-child(2) small {
    display: block !important;
    color: var(--text-dim) !important;
    font-size: 0.72rem !important;
    margin-top: 0.15rem !important;
  }

  /* Amount Paid -> Row 1, Col 2 */
  #table-payments tbody tr td:nth-child(3) {
    grid-column: 2 / 3 !important;
    grid-row: 1 !important;
    padding: 0 !important;
    border: none !important;
    text-align: right !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: var(--accent-emerald-light) !important;
    white-space: nowrap !important;
  }

  /* Date -> Row 2, Col 1 */
  #table-payments tbody tr td:nth-child(1) {
    grid-column: 1 / 2 !important;
    grid-row: 2 !important;
    padding: 0.45rem 0 0 0 !important;
    border: none !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
    font-size: 0.78rem !important;
    color: var(--text-dim) !important;
    white-space: nowrap !important;
  }
  #table-payments tbody tr td:nth-child(1)::before {
    content: "Tanggal: ";
    color: var(--text-dim) !important;
  }

  /* Action Delete -> Row 2, Col 2 */
  #table-payments tbody tr td:nth-child(4) {
    grid-column: 2 / 3 !important;
    grid-row: 2 !important;
    padding: 0.45rem 0 0 0 !important;
    border: none !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
    text-align: right !important;
  }
  #table-payments tbody tr td:nth-child(4) .btn-icon-action {
    width: 28px !important;
    height: 28px !important;
  }

  /* Empty State for Payments Table */
  #table-payments tbody tr:has(td.empty-state) {
    display: block !important;
    background: rgba(30, 41, 59, 0.25) !important;
    border: 1px dashed rgba(255, 255, 255, 0.1) !important;
    border-radius: var(--radius-md) !important;
  }
  #table-payments tbody tr td.empty-state {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 1.25rem 0.75rem !important;
    border: none !important;
    color: var(--text-dim) !important;
    font-size: 0.85rem !important;
  }

  /* Payments Footer - Stately Card */
  #table-payments tfoot,
  #table-payments tfoot tr,
  #table-payments tfoot td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  #table-payments tfoot tr {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.85rem 1rem !important;
    margin-top: 0.75rem !important;
  }
  #table-payments tfoot tr td:nth-child(1) {
    border: none !important;
    padding: 0 !important;
    font-size: 0.82rem !important;
    color: var(--text-muted) !important;
    font-weight: 600 !important;
  }
  #table-payments tfoot tr td:nth-child(2) {
    border: none !important;
    padding: 0 !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    text-align: right !important;
    white-space: nowrap !important;
  }
  #table-payments tfoot tr td:nth-child(3) {
    display: none !important;
  }

  /* Calculation Box in Setoran Panel - Completely Responsive */
  .calc-explanation-card {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.85rem 0.95rem !important;
    margin-top: 1.25rem !important;
    overflow: hidden !important;
  }

  .calc-header-row {
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
    margin-bottom: 0.75rem !important;
  }

  .calc-title {
    font-size: 0.85rem !important;
  }

  .calc-subtitle {
    font-size: 0.68rem !important;
  }

  .calc-step-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.5rem 0.4rem !important;
    gap: 0.5rem !important;
  }

  .calc-step-left {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .calc-step-left .step-badge {
    flex: 0 0 20px !important;
    width: 20px !important;
    height: 20px !important;
    font-size: 0.7rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .calc-step-left .step-label {
    font-size: 0.74rem !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
  }

  .calc-step-item strong {
    flex: 0 0 auto !important;
    text-align: right !important;
    white-space: nowrap !important;
    font-size: 0.85rem !important;
    margin-left: 0.35rem !important;
  }

  .calc-step-highlight strong {
    font-size: 0.98rem !important;
  }

  /* Mobile Modals */
  .modal-card {
    width: calc(100vw - 1.25rem) !important;
    max-width: 95vw !important;
    margin: 0.65rem auto !important;
    padding: 1.25rem 1rem !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  .modal-card.modal-large {
    max-width: 96vw !important;
  }

  .template-manager-toolbar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
  }

  #table-master-templates {
    min-width: 380px !important;
  }
}

@media (max-width: 360px) {
  .kpi-grid {
    grid-template-columns: 1fr !important;
  }
  .brand-title {
    font-size: 1.1rem !important;
  }
  .brand-subtitle {
    display: none !important;
  }
}

/* ================= PRINT / CETAK LAPORAN BULANAN (PDF) ================= */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .checklist-section,
  .quick-add-bar,
  .panel-actions,
  .modal-overlay,
  .toast-container,
  .nav-arrow-btn,
  .btn-action-glow,
  .btn-pay-action,
  .row-actions {
    display: none !important;
  }

  .app-layout {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .panel-card, .kpi-card {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
    color: #000000 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  .period-title, .kpi-value, .panel-title, .meta-val {
    color: #000000 !important;
  }

  .data-table th, .data-table td {
    border-color: #dddddd !important;
    color: #000000 !important;
  }

  .text-income, .text-tithe, .text-due, .text-paid, .text-remaining {
    color: #000000 !important;
    font-weight: bold !important;
  }
}



