:root {
  --royal-navy: #091e3a;
  --royal-blue: #1e40af;
  --primary-gradient: linear-gradient(135deg, #091e3a 0%, #1e3a8a 100%);
  --gold-primary: #c59b27;
  --gold-light: #fef08a;
  --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
  --emerald-green: #059669;
  --emerald-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  
  --bg-main: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #f8fafc 100%);
  --card-bg: rgba(255, 255, 255, 0.98);
  --text-dark: #0f172a;
  --text-muted: #64748b;
  
  --shadow-sm: 0 2px 5px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 25px rgba(9, 30, 58, 0.09);
  --shadow-lg: 0 20px 45px rgba(9, 30, 58, 0.15);
  --shadow-passbook: 0 18px 50px -10px rgba(9, 30, 58, 0.25), 0 0 0 1px rgba(197, 155, 39, 0.3);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background: var(--bg-main);
  min-height: 100vh;
  color: var(--text-dark);
  padding-bottom: 60px;
}

.app-container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Header & Nav */
.header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 14px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1.5px solid #e2e8f0;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #d4af37;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.3);
  transition: transform 0.3s ease;
}

.app-brand-logo:hover {
  transform: scale(1.06) rotate(3deg);
}

.logo-text-group h1 {
  color: var(--royal-navy);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.logo-text-group p {
  font-size: 12px;
  color: #b45309;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  color: var(--royal-navy);
  border: 1.5px solid #cbd5e1;
}

.master-admin-badge {
  background: linear-gradient(135deg, #091e3a 0%, #1e3a8a 100%);
  color: #fef08a;
  border: 1.5px solid #facc15;
  box-shadow: 0 4px 12px rgba(250, 204, 21, 0.2);
}

/* Buttons */
button {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--primary-gradient);
  color: white;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(9, 30, 58, 0.2);
  filter: brightness(1.06);
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background: #ffffff;
  color: #334155;
  border: 1.5px solid #cbd5e1;
}

button.secondary:hover {
  background: #f1f5f9;
}

button.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

button.gold {
  background: var(--gold-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}

button.success {
  background: var(--emerald-gradient);
  color: #ffffff;
}

select, input[type="text"], input[type="password"], input[type="date"], input[type="number"] {
  padding: 11px 15px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 14px;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

select:focus, input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Tabs & Version Bars */
.tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.tabbtn {
  background: #ffffff;
  color: #475569;
  border: 1.5px solid #e2e8f0;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.tabbtn.active {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(9, 30, 58, 0.25);
}

.version-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.version-pill {
  padding: 7px 16px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  transition: all 0.2s;
}

.version-pill.active {
  background: var(--royal-navy);
  color: #fff;
  border-color: var(--royal-navy);
  box-shadow: 0 3px 10px rgba(9, 30, 58, 0.3);
}

.view-container {
  background: var(--card-bg);
  padding: 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1.5px solid #e2e8f0;
}

/* ==========================================================================
/* ==========================================================================
   AUTHENTIC ROYAL PORTRAIT PASSBOOK CARD (High-Fidelity & Canvas Safe)
   ========================================================================== */
.chit-portrait-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0 24px 0;
  width: 100%;
}

.chit-portrait-card {
  position: relative;
  width: 100%;
  max-width: 780px;
  background: #ffffff;
  border-radius: 16px;
  padding: 24px 22px;
  box-shadow: var(--shadow-passbook);
  border: 3px solid #b45309;
  overflow: hidden;
  z-index: 1;
}

/* Reliable inner decorative border (renders 100% cleanly in html2canvas) */
.chit-portrait-card::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border: 1.5px dashed #c59b27;
  border-radius: 10px;
  pointer-events: none;
  z-index: 1;
}

/* High-Definition Centered Watermark Logo (Pure Opacity, No Canvas-Breaking Filters) */
.passbook-big-watermark {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  height: 360px;
  max-width: 80%;
  object-fit: contain;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}

.passbook-content-layer {
  position: relative;
  z-index: 2;
}

/* Sacred Top Blessing */
.passbook-god-header {
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  color: #7f1d1d;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid rgba(197, 155, 39, 0.35);
  font-family: inherit;
}

/* Portrait Brand Header */
.passbook-portrait-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.passbook-crest-logo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #c59b27;
  box-shadow: 0 3px 10px rgba(197, 155, 39, 0.35);
  flex-shrink: 0;
}

.passbook-brand-center {
  text-align: center;
  flex: 1;
}

.passbook-brand-title {
  font-size: 26px;
  font-weight: 900;
  color: #0b2246;
  letter-spacing: -0.3px;
  text-transform: uppercase;
  line-height: 1.15;
  margin: 0;
}

.passbook-brand-slogan {
  font-size: 13px;
  font-weight: 700;
  color: #047857;
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.passbook-crest-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.badge-version-gold {
  background: linear-gradient(135deg, #b45309 0%, #d97706 50%, #f59e0b 100%);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.3);
}

.badge-since-tag {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
}

/* Customer Details Strip */
.passbook-info-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  background: #fdfbf7;
  border: 1.5px solid #d4af37;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
  gap: 10px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-item .info-lbl {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item .info-val {
  font-size: 13px;
  font-weight: 900;
  color: #0b2246;
}

/* Portrait Passbook Table */
.portrait-table-box {
  width: 100%;
  overflow-x: auto;
  border: 2px solid #0b2246;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(9, 30, 58, 0.06);
  margin-bottom: 12px;
}

.portrait-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 12px;
}

.portrait-table th, .portrait-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 5px;
  vertical-align: middle;
}

.portrait-table th {
  background: #0b2246;
  color: #ffffff;
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: 1px solid #1e3a5f;
}

.portrait-table tr.paid-row {
  background: rgba(220, 252, 231, 0.5);
}

.portrait-table tr:nth-child(even):not(.paid-row) {
  background: #fafaf9;
}

.status-badge-chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.status-badge-chip.unpaid {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #cbd5e1;
}

.signature-portrait-box {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signature-portrait-box img {
  max-height: 28px;
  max-width: 75px;
  object-fit: contain;
}

/* Portrait Footer */
.passbook-portrait-footer {
  text-align: center;
  padding-top: 8px;
}

.portrait-payout-box {
  background: #fef3c7;
  border: 1.5px solid #f59e0b;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #92400e;
}

.passbook-calendar-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fffbeb;
  border: 1.5px solid #d97706;
  border-radius: 8px;
  padding: 7px 12px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #92400e;
}

.passbook-version-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 900;
  color: #0b2246;
  margin-bottom: 8px;
}

.passbook-version-divider .ornament {
  color: #d97706;
  font-size: 14px;
}

.portrait-bottom-seal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #0b2246;
  padding: 5px 10px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-radius: 6px;
}

.passbook-actions-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
  width: 100%;
}

.passbook-actions-bar button {
  height: 46px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.passbook-actions-bar button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
}

.passbook-actions-bar button:active {
  transform: translateY(0);
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  .chit-portrait-card, .chit-portrait-card * {
    visibility: visible;
  }
  .chit-portrait-wrapper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 0;
    margin: 0;
  }
  .chit-portrait-card {
    box-shadow: none !important;
    max-width: 100% !important;
    page-break-inside: avoid;
  }
}

/* Admin / Financial Cards */
.admin-card {
  background: #ffffff;
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid #e2e8f0;
  margin-bottom: 22px;
}

.admin-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--royal-navy);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

/* Master KPIs & Tally */
.tally-card {
  background: var(--primary-gradient);
  color: white;
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.tally-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.tally-stat-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 16px;
  backdrop-filter: blur(8px);
}

.tally-stat-box h4 {
  font-size: 12px;
  font-weight: 700;
  color: #bfdbfe;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tally-stat-box .amount {
  font-size: 24px;
  font-weight: 900;
}

.carry-forward-banner {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* Partner Statement Cards */
.partner-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid #e2e8f0;
}

.partner-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #f1f5f9;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.partner-card-header h3 {
  font-size: 20px;
  font-weight: 900;
  color: var(--royal-navy);
}

.partner-metric-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
  color: #475569;
}

.partner-metric-row.cr {
  color: #15803d;
  font-weight: 700;
}

.partner-metric-row.dr {
  color: #b91c1c;
  font-weight: 700;
}

.partner-closing-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 2px dashed #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.balance-val {
  font-size: 22px;
  font-weight: 900;
}

.balance-zero { color: #15803d; }
.balance-surplus { color: #0284c7; }
.balance-deficit { color: #dc2626; }

/* Tables */
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ledger-table th, .ledger-table td {
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  text-align: left;
}

.ledger-table th {
  background: #f8fafc;
  font-weight: 800;
  color: var(--royal-navy);
}

/* Auth Login Modal / Screen */
.login-screen {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  border: 1.5px solid #e2e8f0;
  text-align: center;
}

.login-card h2 {
  color: var(--royal-navy);
  font-size: 24px;
  font-weight: 900;
  margin-top: 8px;
  margin-bottom: 4px;
}

.login-card p {
  color: #b45309;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-switcher {
  display: flex;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.role-switcher button {
  flex: 1;
  background: transparent;
  color: #64748b;
  box-shadow: none;
  font-size: 13px;
  padding: 9px;
}

.role-switcher button.active {
  background: #ffffff;
  color: var(--royal-navy);
  box-shadow: var(--shadow-sm);
  font-weight: 800;
}

@media (max-width: 768px) {
  .header-nav {
    flex-direction: column;
    align-items: stretch;
  }
  .controls {
    justify-content: space-between;
  }
  .passbook-portrait-header {
    flex-direction: column;
    text-align: center;
  }
  .passbook-crest-badge {
    align-items: center;
  }
}

/* ==========================================
   PREMIUM FINTECH / ACCOUNTS STYLES
   ========================================== */
.badge-outside {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  color: #ffffff !important;
  padding: 4px 10px;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.4);
  letter-spacing: 0.3px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}

.badge-outside-amber {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff !important;
  padding: 4px 10px;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.35);
  white-space: nowrap;
}

.badge-cr {
  background: #dcfce7;
  color: #15803d;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid #bbf7d0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-dr {
  background: #fee2e2;
  color: #b91c1c;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid #fecaca;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tally-badge-tallied {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 30px;
  font-weight: 900;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tally-badge-untallied {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 30px;
  font-weight: 900;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.entry-type-switch {
  display: flex;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  gap: 6px;
  border: 1.5px solid #cbd5e1;
}

.entry-type-btn {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 800;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.entry-type-btn.active-cr {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.entry-type-btn.active-dr {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.entry-type-btn:not(.active-cr):not(.active-dr) {
  background: transparent;
  color: #64748b;
  box-shadow: none;
}

.entry-type-btn:not(.active-cr):not(.active-dr):hover {
  background: #e2e8f0;
  color: #0f172a;
}

.outside-alert-card {
  background: linear-gradient(135deg, #fdf4ff 0%, #faf5ff 100%);
  border: 1.5px solid #e9d5ff;
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.08);
}

.fintech-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.fintech-kpi-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 18px 20px;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 4px 15px rgba(9, 30, 58, 0.05);
  position: relative;
  overflow: hidden;
}

.fintech-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.fintech-kpi-card.kpi-cr::before {
  background: linear-gradient(90deg, #10b981, #059669);
}

.fintech-kpi-card.kpi-dr::before {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.fintech-kpi-card.kpi-bal::before {
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

.fintech-kpi-card.kpi-outside::before {
  background: linear-gradient(90deg, #8b5cf6, #d946ef);
}

.breakdown-table-box {
  background: #ffffff;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
  padding: 18px;
  margin-top: 20px;
  box-shadow: 0 4px 15px rgba(9, 30, 58, 0.04);
}

/* App Footer */
.app-footer {
  margin-top: 40px;
  padding: 20px 10px;
  text-align: center;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.app-footer strong {
  color: #0b1f3a;
  font-weight: 700;
}

.app-footer .footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #0b1f3a, #1e3a8a);
  color: #f8fafc;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(11, 31, 58, 0.15);
  margin-top: 6px;
}

/* ==========================================
   MOBILE & TABLET RESPONSIVE STYLES
   ========================================== */
/* ==========================================
   PERFECT MOBILE & TABLET RESPONSIVE STYLES
   ========================================== */
html, body {
  max-width: 100vw;
  overflow-x: hidden !important;
}

@media (max-width: 768px) {
  /* Global Container Padding & No Overflow */
  body, .app-container {
    padding: 8px 8px !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  /* Header & Brand Logo */
  .header-nav {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 10px !important;
    padding: 12px 10px !important;
    border-radius: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .logo-area {
    justify-content: center !important;
    text-align: center !important;
    flex-direction: column !important;
    gap: 6px !important;
  }

  .app-brand-logo {
    width: 44px !important;
    height: 44px !important;
    margin: 0 auto !important;
  }

  .logo-text-group h1 {
    font-size: 19px !important;
  }

  .logo-text-group p {
    font-size: 11px !important;
  }

  /* User Controls & Header Buttons */
  .controls {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .controls .user-badge {
    font-size: 12px !important;
    padding: 6px 10px !important;
    width: 100% !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .controls button {
    width: 100% !important;
    justify-content: center !important;
    font-size: 12px !important;
    padding: 9px 12px !important;
    box-sizing: border-box !important;
  }

  /* Chit Scheme Version Selector Alignment */
  .version-bar {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 12px 10px !important;
    margin-bottom: 14px !important;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 12px !important;
    box-shadow: 0 3px 10px rgba(11, 31, 58, 0.05) !important;
    box-sizing: border-box !important;
  }

  .version-bar strong {
    margin: 0 0 8px 0 !important;
    font-size: 13px !important;
    color: #0b1f3a !important;
    text-align: center !important;
    display: block !important;
    width: 100% !important;
  }

  .version-bar > div,
  .version-pills-container {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .version-pill {
    flex: 1 1 calc(33.33% - 6px) !important;
    min-width: 85px !important;
    text-align: center !important;
    justify-content: center !important;
    padding: 8px 6px !important;
    font-size: 12px !important;
    box-sizing: border-box !important;
  }

  /* Navigation Tabs Equal Grid */
  .tabs {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
    padding: 0 !important;
    margin-bottom: 16px !important;
  }

  .tabbtn {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
    padding: 10px 6px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* Cards & Container Elements */
  .card, .fintech-kpi-card, .breakdown-table-box {
    padding: 12px 10px !important;
    border-radius: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .grid, .grid-2, .grid-3, .summary-grid, .form-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* No Table Overflow: Fit 100% Viewport Width Cleanly */
  div[style*="overflowX"], div[style*="overflow-x"], .table-responsive, .table-container, .portrait-table-box {
    overflow-x: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
  }

  table, table.ledger-table, table.portrait-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    font-size: 11px !important;
    box-sizing: border-box !important;
  }

  th, td {
    padding: 6px 3px !important;
    font-size: 10.5px !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* Passbook Portrait Card Mobile Optimization */
  .passbook-portrait-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 8px !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    border: 1.5px solid #0b2246 !important;
  }

  .passbook-portrait-header {
    flex-direction: column !important;
    text-align: center !important;
    gap: 6px !important;
  }

  .passbook-customer-info-box {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    padding: 8px !important;
  }

  .passbook-portrait-table th,
  .passbook-portrait-table td {
    padding: 5px 2px !important;
    font-size: 10px !important;
  }

  .status-badge-chip {
    padding: 2px 4px !important;
    font-size: 9px !important;
  }

  .passbook-actions-bar {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .passbook-actions-bar button {
    width: 100% !important;
  }

  /* Login Card Mobile */
  .login-screen {
    padding: 14px 8px !important;
  }

  .login-card {
    padding: 18px 12px !important;
    width: 100% !important;
    max-width: 360px !important;
    box-sizing: border-box !important;
  }

  /* Modal Cards Mobile */
  .modal-card {
    width: 95% !important;
    padding: 16px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 480px) {
  .logo-text-group h1 {
    font-size: 17px !important;
  }

  .version-pill {
    flex: 1 1 calc(50% - 6px) !important;
    font-size: 11px !important;
  }

  .tabbtn {
    font-size: 11px !important;
    padding: 8px 4px !important;
  }

  th, td {
    font-size: 10px !important;
    padding: 5px 2px !important;
  }
}




