/* JSR Instalment Receiving - High-Tech Fintech & Mobile-First Stylesheet */
:root {
  --primary: #4F46E5;
  --primary-light: #6366f1;
  --primary-dark: #172554;
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --success: #16A34A;
  --success-bg: #dcfce7;
  --warning: #F59E0B;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --surface: #FFFFFF;
  --bg-main: #F5F7FF;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-stack);
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: clip;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}


/* ==================================================== */
/* CLEAN WHITE FINTECH HEADER (#FFFFFF)                 */
/* ==================================================== */
.app-header {
  background: #ffffff;
  color: #0f172a;
  padding: 6px 14px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  gap: 12px;
}

.app-header-top {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.mobile-header-actions {
  display: none;
}

.mobile-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

.mobile-header-btn .nav-svg {
  width: 14px;
  height: 14px;
  stroke: #475569;
}

.mobile-header-btn.mobile-logout-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
}

.mobile-header-btn.mobile-logout-btn .nav-svg {
  stroke: #dc2626;
  width: 15px;
  height: 15px;
}

.settings-layout-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: max-content;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  color: #ffffff;
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #0f172a;
}

.brand-sub {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 6px;
  justify-content: flex-start;
  margin: 0;
}

.header-stats::-webkit-scrollbar {
  display: none;
}

.stat-pill {
  background: #f8fafc;
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: max-content;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.stat-pill:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.stat-pill span {
  color: #64748b;
  font-size: 11.5px;
  font-weight: 600;
}

.stat-pill strong {
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-pill-active {
  flex-shrink: 0 !important;
  min-width: max-content !important;
}
.stat-pill-active span { color: #475569; }
.stat-pill-active strong { color: #1d4ed8; font-weight: 800; }

.stat-pill-disbursed span { color: #475569; }
.stat-pill-disbursed strong { color: #0f172a; }

.stat-pill-collected span { color: #475569; }
.stat-pill-collected strong { color: #15803d; }

.stat-pill-profit span { color: #475569; }
.stat-pill-profit strong { color: #7c3aed; }

.stat-pill-today span { color: #475569; }
.stat-pill-today strong { color: #16a34a; }

.stat-pill-cash {
  background: #f8fafc !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}
.stat-pill-cash:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}

.stat-pill-settings {
  background: #f8fafc !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
  padding: 5px 9px !important;
}
@media (min-width: 769px) {
  .stat-pill-settings {
    display: none !important;
  }
}
.stat-pill-settings:hover {
  background: #eff6ff !important;
  border-color: #93c5fd !important;
}
.stat-pill-settings:hover svg {
  stroke: #1d4ed8 !important;
  transform: rotate(30deg);
  transition: transform 0.25s ease, stroke 0.2s ease;
}

.offline-sync-pill {
  background: #f0fdf4 !important;
  border: 1px solid #bbf7d0 !important;
}
.offline-sync-pill strong {
  color: #15803d !important;
}

.pwa-install-pill {
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
}
.pwa-install-pill strong {
  color: #1d4ed8 !important;
}

.header-user-section {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.logged-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 9999px;
  padding: 3px 10px 3px 4px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
}

.logged-user-pill:hover {
  background: #f8fafc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
  margin: 0 2px;
}

.user-display-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.user-access-tag {
  font-size: 9.5px;
  font-weight: 800;
  color: #16a34a;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn-header-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #64748b;
  padding: 3px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 2px;
}

.btn-header-logout:hover {
  color: #dc2626;
  background: #fee2e2;
}

/* ==================================================== */
/* MAIN LAYOUT & DESKTOP SIDEBAR (HERO NAVY THEME)      */
/* ==================================================== */
.app-layout {
  display: flex;
  flex: 1;
  position: relative;
}

.sidebar {
  width: 68px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: calc(100vh - 66px);
  position: sticky;
  top: 66px;
  z-index: 90;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: nowrap;
  flex-shrink: 0;
  scrollbar-width: none;
  box-shadow: 1px 0 10px rgba(0, 0, 0, 0.04);
}

.sidebar::-webkit-scrollbar {
  display: none;
}

/* Hover / Move Over -> Open for selection */
.sidebar:hover:not(.force-collapsed) {
  width: 250px;
  box-shadow: 4px 0 20px rgba(15, 23, 42, 0.08);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 13px;
  color: #334155;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.2px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  position: relative;
  min-height: 46px;
}

.nav-svg {
  width: 22px;
  height: 22px;
  stroke: #475569;
  flex-shrink: 0;
  transition: transform 0.2s ease, stroke 0.2s ease;
}

/* Labels slide & fade in on hover */
.nav-link .nav-text {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

.sidebar:hover:not(.force-collapsed) .nav-link .nav-text {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.nav-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.nav-link:hover .nav-svg {
  stroke: #0f172a;
}

.nav-link.active {
  background: #4F46E5;
  color: #ffffff;
  border: 1px solid #6366f1;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  font-weight: 700;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: #a5b4fc;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 8px rgba(165, 180, 252, 0.9);
}

.nav-link.active .nav-svg {
  stroke: #ffffff;
}

/* Sidebar Bottom User & Logout Section (Left Menu Down) */
.sidebar-bottom-section {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  min-height: 44px;
}

.sidebar-user-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar:hover:not(.force-collapsed) .sidebar-user-info {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 9.5px;
  font-weight: 800;
  color: #16a34a;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  color: #dc2626;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.2px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  min-height: 42px;
}

.sidebar-logout-btn:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.sidebar-logout-btn .nav-svg {
  width: 22px;
  height: 22px;
  stroke: #dc2626;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sidebar-logout-btn .nav-text {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

.sidebar:hover:not(.force-collapsed) .sidebar-logout-btn .nav-text {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* ==================================================== */
/* CONTENT WORKSPACE                                    */
/* ==================================================== */
.content-area {
  flex: 1;
  padding: 12px 16px;
  overflow-x: hidden;
  max-width: calc(100vw - 68px);
}

.screen-view {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.screen-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.view-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.view-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.btn-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Specialized Header for Collections / Instalment Sheet */
.collections-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: nowrap;
}

.collections-title-block {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.collections-title-block .view-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.2;
}

.collections-title-block .view-subtitle {
  margin: 2px 0 0 0;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.collections-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.collections-tools input#global-search-input {
  width: 165px;
  height: 34px;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #ffffff;
  transition: width 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.collections-tools input#global-search-input:focus {
  width: 205px;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.collections-tools select#collection-filter-select {
  height: 34px;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #ffffff;
  width: auto;
  max-width: 185px;
  cursor: pointer;
}

.collections-tools .btn-compact {
  height: 34px;
  padding: 0 11px;
  font-size: 12px;
  border-radius: 7px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ==================================================== */
/* BUTTONS & CONTROLS                                   */
/* ==================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.btn-success:hover {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
}

.btn-outline {
  background: white;
  border-color: var(--border);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* ==================================================== */
/* CARDS & KPI METRICS                                  */
/* ==================================================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.kpi-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.6px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

/* ==================================================== */
/* 52-COLUMN COLLECTION MATRIX GRID                     */
/* ==================================================== */
/* ==================================================== */
/* INSTALMENT COLLECTION SHEET MATRIX                   */
/* ==================================================== */
.sheet-info-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.sheet-badges {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sheet-badge {
  background: #f1f5f9;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sheet-badge.green {
  background: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0;
}

.mobile-swipe-hint {
  display: none;
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #bfdbfe;
}

.collection-table-container {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  max-height: calc(100vh - 280px);
  position: relative;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
  -webkit-overflow-scrolling: touch;
}

/* Custom sleek scrollbars */
.collection-table-container::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
.collection-table-container::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: 4px;
}
.collection-table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.collection-table-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 100%;
  font-size: 13px;
  table-layout: auto;
}

.matrix-table th,
.matrix-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
  text-align: left;
  white-space: nowrap;
}

.matrix-table thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 2px solid #cbd5e1;
  font-size: 11px;
  letter-spacing: 0.2px;
}

/* High contrast alternating row styling */
.matrix-table tbody tr:nth-child(even) td {
  background-color: #fafbfc;
}
.matrix-table tbody tr:nth-child(odd) td {
  background-color: #ffffff;
}

/* Row hover highlight */
.matrix-table tbody tr:hover td {
  background-color: #eff6ff !important;
}

/* Sticky Columns for Customer Identification */
.sticky-col-1 {
  position: sticky;
  left: 0;
  z-index: 10;
  background: #ffffff;
  min-width: 70px;
  font-weight: 700;
  border-right: 1px solid #cbd5e1 !important;
}

.sticky-col-2 {
  position: sticky;
  left: 70px;
  z-index: 10;
  background: #ffffff;
  min-width: 150px;
  text-align: left !important;
  font-weight: 600;
  border-right: 1px solid #cbd5e1 !important;
}

.sticky-col-3 {
  position: sticky;
  left: 220px;
  z-index: 10;
  background: #ffffff;
  min-width: 100px;
  font-weight: 700;
  border-right: 2px solid #94a3b8 !important;
  box-shadow: 4px 0 10px -3px rgba(15, 23, 42, 0.08);
}

thead th.sticky-col-1,
thead th.sticky-col-2,
thead th.sticky-col-3 {
  z-index: 30;
  background: #f1f5f9 !important;
}

.matrix-table tbody tr:nth-child(even) td.sticky-col-1,
.matrix-table tbody tr:nth-child(even) td.sticky-col-2,
.matrix-table tbody tr:nth-child(even) td.sticky-col-3 {
  background-color: #f8fafc;
}

.matrix-table tbody tr:hover td.sticky-col-1,
.matrix-table tbody tr:hover td.sticky-col-2,
.matrix-table tbody tr:hover td.sticky-col-3 {
  background-color: #e0f2fe !important;
}

/* Instalment Cell & Badges */
.inst-cell {
  cursor: pointer;
  user-select: none;
  min-width: 44px;
  padding: 5px 5px !important;
  transition: transform 0.1s ease;
}

.inst-cell:active {
  transform: scale(0.92);
}

.badge-received {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 6px;
  width: 34px;
  height: 28px;
  box-shadow: 0 1px 4px rgba(34, 197, 94, 0.4);
}

.badge-pending {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  font-size: 11px;
  border-radius: 6px;
  width: 34px;
  height: 28px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.badge-pending:hover {
  background: #ecfdf5;
  border-color: #22c55e;
  border-style: solid;
  color: #15803d;
  box-shadow: 0 2px 5px rgba(34, 197, 94, 0.2);
}

.badge-partial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 6px;
  width: 36px;
  height: 28px;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.4);
  cursor: pointer;
  letter-spacing: -0.3px;
}

.badge-overdue {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

/* Semantic Status Badges & Pills (Always auto-sized to fit text like Active, Completed, Received) */
.badge-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 10px !important;
  border-radius: 9999px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  width: auto !important;
  min-width: fit-content !important;
  max-width: none !important;
  height: auto !important;
  min-height: 22px !important;
  white-space: nowrap !important;
  letter-spacing: 0.2px;
}

.badge-status.badge-status-completed,
.badge-status-completed {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 1px 4px rgba(22, 163, 74, 0.3) !important;
}

.badge-status.badge-status-active,
.badge-status-active {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.1) !important;
}

.badge-status.badge-status-success,
.badge-status-success {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.1) !important;
}

.badge-status.badge-status-partial,
.badge-status-partial {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
}

.badge-status.badge-status-overdue,
.badge-status-overdue {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
}

/* Quick Entry Toolbar */
.quick-entry-bar {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 18px;
  margin-top: 0;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.06);
}

.input-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-group label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.form-control {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
  background: #ffffff;
}

.form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==================================================== */
/* STANDARD DATA TABLE (DESKTOP)                        */
/* ==================================================== */
.data-table-container {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 var(--border);
  white-space: nowrap;
}

.modal .data-table th,
.modal-body .data-table th,
.data-table-container[style*="overflow-y"] .data-table th,
.data-table-container[style*="max-height"] .data-table th {
  top: 0;
}

.data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #f1f5f9;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Sticky Right Actions Column */
.data-table th:last-child,
.data-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 12;
  box-shadow: -3px 0 8px rgba(15, 23, 42, 0.06);
}

.data-table th:last-child {
  background: #f8fafc;
  z-index: 20;
}

.data-table td:last-child {
  background: #ffffff;
}

.data-table tbody tr:hover td:last-child {
  background: #f8fafc;
}

/* Progress Bar */
.progress-bar-bg {
  background: #e2e8f0;
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
  width: 100%;
}

.progress-bar-fill {
  background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
  height: 100%;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* ==================================================== */
/* MODALS                                               */
/* ==================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overscroll-behavior: contain;
}

.modal-overlay.active {
  display: flex !important;
}

body.modal-open {
  overflow: hidden !important;
}

body.modal-open .modal-dialog,
body.modal-open .modal-body,
body.modal-open .loans-tooltip-popover {
  touch-action: pan-y !important;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin: 16px;
}

.modal-dialog.large {
  max-width: 900px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  flex-shrink: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.modal-close:hover {
  color: #334155;
}

.modal-dialog form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Modal Body scrollbar styling */
.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: #f1f5f9;
}
.modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
  flex-shrink: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-full {
  grid-column: span 2;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
}

.form-help {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Preset Pills for Quick Margin & Instalment selection */
.preset-pill {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.12s ease;
}

.preset-pill:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

/* Loan Badge for Multi-loan customers */
.loan-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  margin-left: 3px;
  vertical-align: middle;
}

/* ==================================================== */
/* MOBILE BOTTOM NAVIGATION BAR (LIGHT THEME)           */
/* ==================================================== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  padding: 6px 0;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 3px;
  border-radius: 8px;
}

.mobile-nav-item .nav-svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  transition: all 0.2s ease;
}

.mobile-nav-item.active {
  color: #4F46E5;
  background: #eef2ff;
}

.mobile-nav-item.active .nav-svg {
  stroke: #4F46E5;
  filter: drop-shadow(0 0 6px rgba(79, 70, 229, 0.4));
}

.mobile-nav-item:active {
  transform: scale(0.92);
}

/* ==================================================== */
/* MOBILE CUSTOMER TOUCH-CARDS                          */
/* ==================================================== */
.mobile-cards-list {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.customer-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease;
}

.customer-card:active {
  transform: scale(0.99);
}

.customer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.customer-card-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.customer-card-num {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.customer-card-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.customer-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.customer-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 12px 0;
}

.card-stat-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}

.card-stat-val {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 1px;
}

/* Customer Master Table Actions (Compact 2x2 Grid with Fintech Color Coding) */
.cust-row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  gap: 5px;
  width: 160px;
}

.btn-cust-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 6px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease-in-out;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  line-height: 1.2;
}

.btn-cust-action:active {
  transform: scale(0.96);
}

/* Edit: Soft Ice Blue */
.btn-cust-action.btn-cust-edit {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.btn-cust-action.btn-cust-edit:hover {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.18);
  transform: translateY(-1px);
}

/* Passbook: Soft Mint Green */
.btn-cust-action.btn-cust-passbook {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}
.btn-cust-action.btn-cust-passbook:hover {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.18);
  transform: translateY(-1px);
}

/* Delete: Soft Rose Red (Moved Outside) */
.btn-cust-action.btn-cust-delete {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}
.btn-cust-action.btn-cust-delete:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.18);
  transform: translateY(-1px);
}

/* More: Soft Sleek Purple (Compact, Never Bulky) */
.btn-cust-action.btn-cust-more {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}
.btn-cust-action.btn-cust-more:hover {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #c4b5fd;
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.18);
  transform: translateY(-1px);
}

.customer-card-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.customer-card-actions .btn-cust-action {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 8px;
  min-height: 38px;
}

/* ==================================================== */
/* RESPONSIVE BREAKPOINTS (MOBILE & TABLET)             */
/* ==================================================== */
@media (max-width: 1024px) {
  .collections-header {
    flex-wrap: wrap !important;
  }
  .collections-tools {
    flex-wrap: wrap;
    width: 100%;
  }
}

@media (max-width: 768px) {
  /* Enforce native 1:1 scale on phones (disable 90% desktop zoom on mobile) */
  body {
    zoom: 1 !important;
  }

  /* Safe container overflow so sticky header never breaks */
  html,
  body {
    overflow-x: clip;
    max-width: 100vw;
  }

  /* Sticky Frosted Mobile Header */
  .app-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    padding: 8px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
  }

  .app-header-top {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .brand-section {
    gap: 8px;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: 8px;
  }

  .brand-title {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.1;
  }

  .brand-sub {
    font-size: 10px;
    color: #64748b;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Mobile Header Quick Actions: Settings & Logout Relocated */
  .mobile-header-actions {
    display: flex !important;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
  }

  .mobile-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 32px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
  }

  .mobile-header-btn .nav-svg {
    width: 14px;
    height: 14px;
    stroke: #475569;
  }

  .mobile-header-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
  }

  .mobile-header-btn.active {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
  }

  .mobile-header-btn.active .nav-svg {
    stroke: #1d4ed8;
  }

  .mobile-header-btn.mobile-logout-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
  }

  .mobile-header-btn.mobile-logout-btn .nav-svg {
    stroke: #dc2626;
    width: 15px;
    height: 15px;
  }

  .mobile-header-btn.mobile-logout-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
  }

  .mobile-header-btn:active {
    transform: scale(0.95);
  }

  /* Header Stat Ticker on Mobile (Full Touch Scrollability) */
  .header-stats {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x !important;
    scroll-behavior: smooth !important;
    overscroll-behavior-x: contain !important;
    gap: 6px !important;
    padding: 3px 2px !important;
    scrollbar-width: none !important;
    flex-wrap: nowrap !important;
  }
  .header-stats::-webkit-scrollbar {
    display: none !important;
  }

  .stat-pill {
    padding: 5px 10px !important;
    font-size: 11px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .stat-pill strong {
    font-size: 12px !important;
  }

  /* View Header on Mobile - Clean 1-line layout (prevents button clipping) */
  .view-header {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
    flex-wrap: nowrap !important;
  }

  .view-title {
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
  }

  .view-subtitle {
    display: none !important;
  }

  .view-header .btn-group {
    flex-shrink: 0 !important;
    display: flex !important;
    gap: 6px !important;
  }

  .view-header .btn-group .btn {
    padding: 7px 12px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
  }

  /* Hide Desktop Sidebar on Mobile */
  .sidebar {
    display: none !important;
  }

  /* Full-width content with bottom nav clearance & zero horizontal wobble */
  .content-area {
    max-width: 100vw;
    padding: 12px 10px calc(72px + env(safe-area-inset-bottom, 8px)) 10px !important;
    overflow-x: hidden;
  }

  /* Mobile Bottom Navigation (5 core tabs) */
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding: 0 4px env(safe-area-inset-bottom, 0px) 4px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 100;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
    justify-content: space-around;
    align-items: center;
  }

  .mobile-nav-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    gap: 2px;
    transition: all 0.15s ease;
  }

  .mobile-nav-item .nav-svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    transition: all 0.15s ease;
  }

  .mobile-nav-item.active {
    color: #4F46E5;
    background: #eef2ff;
  }

  .mobile-nav-item.active .nav-svg {
    stroke: #4F46E5;
    filter: drop-shadow(0 0 4px rgba(79, 70, 229, 0.4));
  }

  .mobile-nav-item:active {
    transform: scale(0.92);
  }

  /* 2-Column KPI Cards Grid on Mobile across ALL screen sizes */
  .cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .card {
    padding: 12px 14px !important;
    border-radius: 12px !important;
  }

  .card.kpi-card-featured {
    grid-column: 1 / -1 !important;
    background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%) !important;
    border: 1px solid #bfdbfe !important;
  }

  .kpi-title {
    font-size: 10.5px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
  }

  .kpi-value {
    font-size: 20px !important;
    font-weight: 800 !important;
    margin: 3px 0 2px 0 !important;
  }

  .kpi-sub {
    font-size: 11px !important;
  }

  /* Milestone distribution grid on mobile */
  .milestone-distribution-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Collections Header Mobile */
  .collections-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .collections-tools {
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .collections-tools input#global-search-input {
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  .collections-tools select#collection-filter-select {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }

  .collections-tools .btn-compact {
    flex: 1 1 calc(33.33% - 4px) !important;
    justify-content: center !important;
    padding: 7px 8px !important;
    font-size: 11.5px !important;
  }

  /* Show horizontal swipe hint on Mobile */
  .mobile-swipe-hint {
    display: inline-flex !important;
  }

  .sheet-info-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* Mobile Collection Table & Sticky Columns */
  .collection-table-container {
    max-height: calc(100vh - 250px);
    border-radius: 10px;
    box-shadow: none;
  }

  /* Only Cust # (48px) and Customer Name (105px) remain sticky on mobile */
  .sticky-col-1 {
    min-width: 48px !important;
    width: 48px !important;
    max-width: 48px !important;
    padding: 6px 4px !important;
    font-size: 11px !important;
  }

  .sticky-col-2 {
    left: 48px !important;
    min-width: 105px !important;
    width: 105px !important;
    max-width: 115px !important;
    padding: 6px 6px !important;
    box-shadow: 4px 0 8px -2px rgba(0, 0, 0, 0.15) !important;
    border-right: 2px solid #94a3b8 !important;
  }

  .sticky-col-2 div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 95px;
  }

  .sticky-col-3 {
    position: static !important;
    box-shadow: none !important;
    border-right: 1px solid #cbd5e1 !important;
    min-width: 80px !important;
    padding: 6px 6px !important;
    font-size: 11px !important;
  }

  thead th.sticky-col-3 {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    z-index: 20 !important;
    box-shadow: none !important;
  }

  /* Touch-friendly Instalment Cells on Mobile */
  .matrix-table th,
  .matrix-table td {
    padding: 5px 4px !important;
  }

  .inst-cell {
    min-width: 38px !important;
    padding: 4px 2px !important;
  }

  .matrix-table td .badge-received,
  .matrix-table td .badge-pending,
  .matrix-table td .badge-partial {
    width: 32px !important;
    height: 26px !important;
    font-size: 11px !important;
    padding: 0 !important;
  }

  .badge-status,
  .status-pill,
  .badge-received:not(.matrix-table td .badge-received) {
    width: auto !important;
    height: auto !important;
    min-height: 22px !important;
    white-space: nowrap !important;
  }

  /* Mobile Quick Entry Bar */
  .quick-entry-bar {
    padding: 12px !important;
    border-radius: 12px !important;
    background: #eff6ff !important;
    border: 1px solid #bfdbfe !important;
    gap: 8px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .quick-entry-bar .input-group {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .quick-entry-bar .input-group input {
    flex: 1 !important;
    width: auto !important;
  }

  .quick-entry-bar .btn {
    width: 100% !important;
    padding: 10px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
  }

  /* Run Sheet Checklist on Mobile */
  .runsheet-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .runsheet-card {
    padding: 14px !important;
    border-radius: 12px !important;
  }

  .runsheet-actions {
    display: flex !important;
    gap: 6px !important;
  }

  .runsheet-actions .btn {
    flex: 1 1 calc(50% - 4px) !important;
    padding: 9px 8px !important;
    font-size: 12px !important;
    justify-content: center !important;
  }

  /* Switch Customer view on Mobile */
  .desktop-only-table {
    display: none !important;
  }
  .mobile-cards-list {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }

  .customer-card {
    padding: 14px !important;
    border-radius: 12px !important;
  }

  .customer-card-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .customer-card-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .customer-card-actions .btn {
    flex: 1 1 calc(33.33% - 4px) !important;
    padding: 7px 6px !important;
    font-size: 11.5px !important;
    justify-content: center !important;
  }

  /* Analytics Grid on Mobile */
  .analytics-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .analytics-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* Settings Grid on Mobile (Fixes media_1791897867213.png squishing!) */
  .settings-layout-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Modals as Full Bottom Sheets on Mobile with Smooth Scrolling */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
    z-index: 100000 !important;
  }

  .modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 90dvh !important;
    max-height: calc(100dvh - 20px) !important;
    height: auto !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: slideUpMobile 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35) !important;
  }

  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-header {
    padding: 14px 18px !important;
    flex-shrink: 0 !important;
    background: #ffffff !important;
    border-bottom: 1px solid var(--border) !important;
  }

  .modal-dialog form {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .modal-body {
    padding: 16px 18px 24px 18px !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .form-full {
    grid-column: span 1 !important;
  }

  .modal-footer {
    padding: 12px 18px !important;
    padding-bottom: max(14px, env(safe-area-inset-bottom, 14px)) !important;
    flex-shrink: 0 !important;
    background: #f8fafc !important;
    border-top: 1px solid var(--border) !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    z-index: 10 !important;
  }

  .modal-footer .btn {
    min-height: 44px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    justify-content: center !important;
  }
}

@media (max-width: 480px) {
  .brand-title {
    font-size: 15px;
  }

  .view-title {
    font-size: 16px;
  }
}

/* ==================================================== */
/* PRINT SHEET STYLING                                  */
/* ==================================================== */
@media print {
  body {
    zoom: 1 !important;
    background: white !important;
  }
  .app-header,
  .sidebar,
  .mobile-nav,
  .btn-group,
  .collections-tools,
  .quick-entry-bar,
  .modal-overlay {
    display: none !important;
  }
  .content-area {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .collection-table-container {
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
  }
  .matrix-table {
    border: 1px solid #000;
  }
  .matrix-table th,
  .matrix-table td {
    border: 1px solid #ccc !important;
    padding: 4px !important;
    font-size: 10px !important;
  }
  .badge-received {
    background: #000 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
  }
  .badge-pending {
    border: 1px solid #888 !important;
  }

  /* Passbook Print Support: In-page fallback and Ctrl+P handling */
  body.printing-passbook .app-header,
  body.printing-passbook .sidebar,
  body.printing-passbook .mobile-nav,
  body.printing-passbook .screen-view,
  body.printing-passbook .content-area,
  body.printing-passbook .quick-entry-bar,
  body:has(#modal-passbook.active) .app-header,
  body:has(#modal-passbook.active) .sidebar,
  body:has(#modal-passbook.active) .mobile-nav,
  body:has(#modal-passbook.active) .screen-view,
  body:has(#modal-passbook.active) .content-area,
  body:has(#modal-passbook.active) .quick-entry-bar {
    display: none !important;
  }

  body.printing-passbook #modal-passbook,
  body:has(#modal-passbook.active) #modal-passbook {
    display: block !important;
    position: static !important;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    box-shadow: none !important;
    z-index: 99999 !important;
  }

  body.printing-passbook #modal-passbook .modal-dialog,
  body:has(#modal-passbook.active) #modal-passbook .modal-dialog {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.printing-passbook #modal-passbook .modal-header,
  body:has(#modal-passbook.active) #modal-passbook .modal-header {
    border-bottom: 2px solid #0f172a !important;
    padding: 8px 0 !important;
    margin-bottom: 12px !important;
  }

  body.printing-passbook #modal-passbook .modal-footer,
  body.printing-passbook #modal-passbook .modal-close,
  body:has(#modal-passbook.active) #modal-passbook .modal-footer,
  body:has(#modal-passbook.active) #modal-passbook .modal-close {
    display: none !important;
  }

  body.printing-passbook #modal-passbook .data-table-container,
  body:has(#modal-passbook.active) #modal-passbook .data-table-container {
    max-height: none !important;
    overflow: visible !important;
    border: 1px solid #0f172a !important;
  }

  body.printing-passbook #modal-passbook table,
  body:has(#modal-passbook.active) #modal-passbook table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  body.printing-passbook #modal-passbook table th,
  body.printing-passbook #modal-passbook table td,
  body:has(#modal-passbook.active) #modal-passbook table th,
  body:has(#modal-passbook.active) #modal-passbook table td {
    padding: 4px 6px !important;
    font-size: 11px !important;
    border: 1px solid #cbd5e1 !important;
  }

  body.printing-passbook #modal-passbook table th:last-child,
  body.printing-passbook #modal-passbook table td:last-child,
  body:has(#modal-passbook.active) #modal-passbook table th:last-child,
  body:has(#modal-passbook.active) #modal-passbook table td:last-child {
    display: none !important;
  }
}

/* ==================================================== */
/* FIELD COLLECTION RUN SHEET                          */
/* ==================================================== */
.runsheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.runsheet-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.runsheet-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.runsheet-card.is-paid-today {
  border-color: #86efac;
  background: #f0fdf4;
}

.runsheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.runsheet-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
}

/* ==================================================== */
/* CASH TALLY & DENOMINATION CALCULATOR                 */
/* ==================================================== */
.denomination-table {
  width: 100%;
  border-collapse: collapse;
}

.denomination-table th,
.denomination-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
}

.denomination-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-align: left;
}

.sound-toggle-btn {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.sound-toggle-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* ==================================================== */
/* HIGH-TECH MODERN FINTECH LOGIN OVERLAY               */
/* ==================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.98));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-container {
  display: flex;
  max-width: 960px;
  width: 100%;
  min-height: 560px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  animation: loginModalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.login-showcase {
  flex: 1.1;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a8a 50%, #1d4ed8 100%);
  color: #ffffff;
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-showcase::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.35) 0%, rgba(59, 130, 246, 0) 70%);
  pointer-events: none;
}

.login-brand-tag {
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 2;
}

.login-brand-tag .brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.login-brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.login-brand-sub {
  font-size: 12px;
  color: #93c5fd;
  font-weight: 500;
}

.login-artwork-wrap {
  text-align: center;
  margin: 16px 0;
  z-index: 2;
}

.login-hero-img {
  width: 100%;
  max-width: 280px;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  border-radius: 16px;
  filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.45));
  transition: transform 0.3s ease;
}

.login-hero-img:hover {
  transform: scale(1.03);
}

.login-features-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2;
}

.login-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.4;
}

.login-feature-item strong {
  display: block;
  color: #ffffff;
  font-size: 12px;
}

.login-feature-item p {
  margin: 1px 0 0 0;
  color: #cbd5e1;
  font-size: 11px;
}

.login-feat-icon {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.login-form-card {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #ffffff;
}

.login-form-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.login-form-header p {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 24px;
  line-height: 1.4;
}

.login-error-alert {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 12px;
  font-size: 15px;
  color: #64748b;
  pointer-events: none;
}

.login-input {
  padding-left: 38px !important;
  padding-right: 42px !important;
  height: 44px;
  font-size: 14px;
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.login-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.btn-toggle-pwd {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: background 0.15s ease;
}

.btn-toggle-pwd:hover {
  background: #f1f5f9;
}

.btn-login-submit {
  width: 100%;
  height: 46px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  cursor: pointer;
}

.btn-quick-demo {
  width: 100%;
  height: 44px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1.5px solid #f59e0b;
  color: #92400e;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-quick-demo:hover {
  background: #fde68a;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.25);
}

.login-security-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 11px;
  color: #94a3b8;
}

/* ==================================================== */
/* INTERACTIVE SCHEDULE DRAWER & PROGRESS COMPONENT    */
/* ==================================================== */
.clickable-paid-bal {
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
  user-select: none;
}

.clickable-paid-bal:hover {
  background: #eff6ff !important;
}

.clickable-paid-bal.expanded {
  background: #dbeafe !important;
}

.sched-chevron {
  font-size: 9px;
  color: #64748b;
  transition: transform 0.2s ease;
  display: inline-block;
  padding: 2px 4px;
  border-radius: 4px;
  background: #f1f5f9;
}

.clickable-paid-bal:hover .sched-chevron {
  color: #1e40af;
  background: #e0e7ff;
}

.sched-chevron.rotated {
  transform: rotate(180deg);
  color: #1e40af;
  background: #bfdbfe;
}

.schedule-drawer-row {
  background: #f8fafc;
  border-bottom: 2px solid #bfdbfe;
}

.schedule-drawer-cell {
  padding: 0 !important;
  background: #f8fafc;
}

.schedule-panel {
  padding: 16px 20px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-left: 4px solid #2563eb;
  margin: 6px 12px 14px 12px;
  border-radius: 10px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), inset 0 1px 2px rgba(0, 0, 0, 0.03);
  animation: scheduleDrawerOpen 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scheduleDrawerOpen {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.schedule-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

.schedule-panel-title {
  font-weight: 800;
  font-size: 14px;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-panel-hint {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 4px;
}

.schedule-progress-bar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.schedule-progress-track {
  flex: 1;
  height: 12px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.schedule-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #16a34a 100%);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.schedule-progress-pct {
  font-size: 13px;
  font-weight: 800;
  color: #16a34a;
  min-width: 50px;
  text-align: right;
}

.schedule-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  font-size: 12px;
  color: #475569;
  flex-wrap: wrap;
}

.sched-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sched-legend-box {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.sched-legend-box.paid {
  background: #16a34a;
  color: #ffffff;
}

.sched-legend-box.pending {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #64748b;
}

.sched-legend-box.partial {
  background: #f59e0b;
  color: #ffffff;
}

.schedule-squares-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.sched-square {
  height: 34px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  position: relative;
}

.sched-square:hover {
  transform: translateY(-1px);
  z-index: 2;
}

.sched-square.is-paid {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  border: none !important;
  box-shadow: 0 1px 4px rgba(34, 197, 94, 0.4) !important;
}

.sched-square.is-partial {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  border: none !important;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.4) !important;
}

.sched-square.is-pending {
  background: #ffffff !important;
  color: #94a3b8 !important;
  border: 1px dashed #cbd5e1 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

.sched-square.is-pending:hover {
  background: #ecfdf5 !important;
  border-color: #22c55e !important;
  border-style: solid !important;
  color: #15803d !important;
  box-shadow: 0 2px 5px rgba(34, 197, 94, 0.2) !important;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  .login-container {
    flex-direction: column;
    max-height: 92vh;
    overflow-y: auto;
    margin: 10px;
    border-radius: 16px;
  }

  .login-showcase {
    padding: 24px 20px;
    text-align: center;
    align-items: center;
  }

  .login-brand-tag {
    justify-content: center;
  }

  .login-features-list {
    display: none;
  }

  .login-hero-img {
    max-height: 120px;
    max-width: 180px;
    margin: 6px 0;
  }

  .login-form-card {
    padding: 24px 20px;
  }

  .schedule-panel {
    margin: 4px;
    padding: 12px;
  }

  .schedule-squares-grid {
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 4px;
  }

  .sched-square {
    height: 32px;
    font-size: 11px;
  }
}

/* ==================================================== */
/* HEADER LOGOUT & LOANS COLUMN TOOLTIP STYLES          */
/* ==================================================== */
.btn-header-logout {
  transition: all 0.2s ease !important;
}

.btn-header-logout:hover {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15) !important;
  transform: translateY(-1px);
}

.loans-badge {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.loans-badge:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}

.loans-popover-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 99998;
  animation: fadeIn 0.15s ease;
}

.loans-tooltip-popover {
  position: fixed;
  z-index: 99999;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35), 0 10px 20px -5px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  padding: 0;
  color: #1e293b;
  font-size: 13px;
}

/* Mobile: Natural full-width bottom sheet matching device size */
@media (max-width: 768px) {
  .loans-tooltip-popover {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 85dvh !important;
    max-height: 85vh !important;
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35) !important;
    animation: tooltipFadeIn 0.15s ease-out !important;
  }
}

/* Desktop: Elegantly centered viewport-bounded modal dialog */
@media (min-width: 769px) {
  .loans-tooltip-popover {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    right: auto !important;
    bottom: auto !important;
    width: 92% !important;
    max-width: 440px !important;
    max-height: min(85vh, 620px) !important;
    border-radius: 16px !important;
    animation: tooltipFadeIn 0.15s ease-out !important;
  }
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.loans-tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
  padding: 14px 18px 12px 18px;
  background: #f8fafc;
  flex-shrink: 0;
  margin: 0;
  font-weight: 800;
  font-size: 13.5px;
  color: #0f172a;
}

.loans-customer-summary-card {
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 12px 16px 8px 16px;
  flex-shrink: 0;
}

.loans-tooltip-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
}

.loans-tooltip-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
}

@media (max-width: 768px) {
  .loans-tooltip-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  }
}

.cust-total-sub {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  margin-top: 2px;
}

/* 4-Column Table Schedule Cell */
.schedule-expand-cell {
  cursor: pointer;
  text-align: center;
  padding: 10px 12px !important;
}

.btn-schedule-toggle {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-schedule-toggle:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.btn-schedule-toggle.expanded {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}

/* User Reference Schedule Card (media_1791962217864.png) */
.schedule-card-container {
  border: 1.5px solid #10b981;
  border-radius: 12px;
  background: #ffffff;
  padding: 18px 20px;
  margin: 10px 12px 16px 12px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.08);
  animation: scheduleDrawerOpen 0.22s ease-out;
}

.schedule-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.sched-card-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sched-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  flex-shrink: 0;
}

.sched-user-name {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.loan-badge-pill {
  font-size: 11px;
  font-weight: 700;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 1px 6px;
  border-radius: 4px;
}

.sched-user-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.sched-user-amt {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-top: 2px;
}

.sched-card-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sched-paid-stat {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.sched-card-collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #475569;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.sched-card-collapse-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.sched-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.sched-progress-bar {
  flex: 1;
  height: 8px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
}

.sched-progress-fill {
  height: 100%;
  background: #10b981;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.sched-progress-pct {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  min-width: 35px;
  text-align: right;
}

.sched-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.sched-grid-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.sched-grid-action {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
}

.sched-13col-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 6px;
}

.sched-13col-grid .sched-square {
  height: 34px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.sched-13col-grid .sched-square.is-paid {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  border: none;
  box-shadow: 0 1px 4px rgba(34, 197, 94, 0.4);
}

.sched-13col-grid .sched-square.is-pending {
  background: #ffffff;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  font-size: 11px;
  font-weight: 600;
}

.sched-13col-grid .sched-square.is-pending:hover {
  background: #ecfdf5;
  border-color: #22c55e;
  border-style: solid;
  color: #15803d;
  box-shadow: 0 2px 5px rgba(34, 197, 94, 0.2);
  transform: translateY(-1px);
}

.sched-13col-grid .sched-square.is-next-due {
  background: #ffffff;
  border: 1.5px solid #16a34a;
  color: #15803d;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

.sched-13col-grid .sched-square.is-next-due:hover {
  background: #ecfdf5;
  border-color: #15803d;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.35);
  transform: translateY(-1px);
}

.sched-13col-grid .sched-square.is-locked {
  background: #f8fafc;
  color: #cbd5e1;
  border: 1px dashed #e2e8f0;
  cursor: not-allowed !important;
  opacity: 0.65;
}

.sched-13col-grid .sched-square.is-locked:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
  border-style: dashed;
  color: #cbd5e1;
  box-shadow: none;
  transform: none;
}

.sched-13col-grid .sched-square.is-locked-paid {
  cursor: not-allowed;
}

.sched-13col-grid .sched-square.is-partial {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  border: none;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.4);
}

.sched-card-footer {
  margin-top: 12px;
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 900px) {
  .sched-13col-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

@media (max-width: 550px) {
  .sched-13col-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==================================================== */
/* PROMINENT COLLECTION SUCCESS BANNER                  */
/* ==================================================== */
.collection-success-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100005 !important;
  min-width: 320px;
  max-width: 90vw;
  animation: bannerSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bannerSlideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.collection-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(21, 128, 61, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border: 1.5px solid #86efac;
}

.collection-banner-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  flex-shrink: 0;
}

.collection-banner-details {
  flex: 1;
}

.collection-banner-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.collection-banner-subtitle {
  font-size: 13px;
  opacity: 0.92;
  margin-top: 2px;
}

.collection-banner-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.collection-banner-close:hover {
  opacity: 1;
}

.collection-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}
.collection-banner-undo-btn {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
  padding: 5px 12px !important;
  border-radius: 6px !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12) !important;
}
.collection-banner-undo-btn:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #000000 !important;
  transform: translateY(-1px);
}
.collection-banner-wa-btn {
  background: #25D366 !important;
  color: #ffffff !important;
  border: none !important;
  padding: 6px 9px !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}
.collection-banner-wa-btn:hover {
  background: #1eb956 !important;
  transform: translateY(-1px);
}

/* Row Save Button */
.btn-row-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #ffffff !important;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.35);
  animation: savePulse 1.8s infinite;
}

.btn-row-save:hover {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.45);
}

@keyframes savePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.sched-modified-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 8px;
  padding: 10px 16px;
  margin-top: 14px;
}

.btn-drawer-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}

.btn-drawer-save:hover {
  background: #15803d;
}

/* ==================================================== */
/* MOBILE INSTALMENT CARDS (Matching media_1791982219543)*/
/* ==================================================== */
.desktop-only-collections {
  display: block;
}

.mobile-only-collections {
  display: none;
}

@media (max-width: 900px) {
  .desktop-only-collections {
    display: none !important;
  }

  .mobile-only-collections {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  /* Fix: Hide duplicate second logout button in stats pill on mobile */
  .btn-header-logout {
    display: none !important;
  }

  /* Full Width Rounded Mobile Search Input matching Image 2 */
  .collections-tools input#global-search-input {
    border-radius: 9999px !important;
    padding: 10px 18px !important;
    height: 42px !important;
    font-size: 13.5px !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  }

  .collections-tools input#global-search-input:focus {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
  }
}

.mobile-cust-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  cursor: pointer;
}

.mobile-cust-card.card-expanded {
  border-color: #10b981;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.08);
}

.mobile-cust-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  user-select: none;
}

.mobile-cust-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-cust-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  flex-shrink: 0;
}

.mobile-cust-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-cust-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.mobile-cust-sub {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 1px;
}

.mobile-cust-amt {
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  margin-top: 2px;
}

.mobile-cust-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-cust-paid {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-align: right;
  white-space: nowrap;
}

.mobile-cust-chevron {
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-cust-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.mobile-cust-progress-bar {
  flex: 1;
  height: 6px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
}

.mobile-cust-progress-fill {
  height: 100%;
  background: #10b981;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.mobile-cust-progress-pct {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  min-width: 32px;
  text-align: right;
}

.mobile-cust-drawer-body {
  margin-top: 4px;
  animation: scheduleDrawerOpen 0.2s ease-out;
}

.mobile-sched-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr) !important;
  gap: 4px !important;
}

.mobile-sched-grid .sched-square {
  height: 28px !important;
  font-size: 10px !important;
  border-radius: 4px !important;
}

@media (max-width: 480px) {
  .mobile-sched-grid {
    gap: 3px !important;
  }
  .mobile-sched-grid .sched-square {
    height: 26px !important;
    font-size: 9px !important;
  }
}

/* ==================================================== */
/* GREENFIELD EXTENSIONS: GOOGLE SSO & WHITELIST GATE   */
/* ==================================================== */
.btn-google-sso {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.btn-google-sso:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.btn-google-sso:active {
  transform: scale(0.98);
}
.btn-owner-quick-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e40af;
  border: 1.5px solid #93c5fd;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}
.btn-owner-quick-login:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #60a5fa;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}
.btn-owner-quick-login:active {
  transform: scale(0.98);
}
.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e2e8f0;
}
.login-divider span {
  padding: 0 10px;
}

/* ==================================================== */
/* GLOBAL COMMAND PALETTE (CMD+K / CTRL+K)              */
/* ==================================================== */
.command-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100001;
  animation: fadeIn 0.15s ease;
}
.command-palette-modal {
  position: fixed;
  top: 15vh;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.35);
  border: 1px solid #cbd5e1;
  z-index: 100002;
  overflow: hidden;
  animation: modalIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.command-palette-search-wrap {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  gap: 12px;
}
.command-search-icon {
  width: 18px;
  height: 18px;
  color: #64748b;
  flex-shrink: 0;
}
.command-palette-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  color: #0f172a;
  outline: none;
}
.command-esc-badge {
  font-size: 11px;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
}
.command-palette-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}
.command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.command-item:hover, .command-item.selected {
  background: #eff6ff;
}
.command-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.command-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #2563eb;
  font-size: 14px;
}
.command-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
}
.command-item-sub {
  font-size: 11.5px;
  color: #64748b;
}

/* Pitfall #13: Standardize search input left padding */
.input-with-icon input.form-control,
.search-icon-padded {
  padding-left: 40px !important;
}

/* WCAG 2.1 AA/AAA Focus Rings & Indicators */
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4) !important;
}

/* ==================================================== */
/* EXCEL & CSV DATA IMPORT UI                           */
/* ==================================================== */
.excel-drop-zone {
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  background: #f8fafc;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 14px 0;
}
.excel-drop-zone:hover, .excel-drop-zone.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}
.excel-drop-icon {
  font-size: 34px;
  margin-bottom: 8px;
}
.excel-drop-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}
.excel-drop-subtitle {
  font-size: 12px;
  color: #64748b;
}
.excel-preview-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.excel-preview-stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}
.excel-preview-stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 700;
}
.excel-preview-stat-val {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin-top: 2px;
}
@media (max-width: 640px) {
  .excel-preview-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==================================================== */
/* MODERN INSTALMENT SCREEN (IMAGE MATCH)               */
/* ==================================================== */
.coll-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.coll-kpi-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}
.coll-kpi-card.card-blue {
  background: #eff6ff;
  border-color: #dbeafe;
}
.coll-kpi-card.card-green {
  background: #f0fdf4;
  border-color: #dcfce7;
}
.coll-kpi-card.card-indigo {
  background: #eef2ff;
  border-color: #e0e7ff;
}
.coll-kpi-card.card-orange {
  background: #fff7ed;
  border-color: #ffedd5;
}
.coll-kpi-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.coll-kpi-currency-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #dcfce7;
  color: #16a34a;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.coll-kpi-content {
  display: flex;
  flex-direction: column;
}
.coll-kpi-label {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 600;
}
.coll-kpi-value {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin-top: 1px;
}
@media (max-width: 768px) {
  .coll-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .coll-kpi-value {
    font-size: 15px;
  }
}

.coll-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 16px 0 12px 0;
}
.coll-search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.coll-search-wrap {
  flex: 1;
  position: relative;
  min-width: 200px;
}
.coll-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #94a3b8;
  pointer-events: none;
}
.coll-search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s;
}
.coll-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.coll-filter-select {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  background: #ffffff;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  outline: none;
}
.coll-action-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.coll-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #1e293b;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.coll-btn-action:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.coll-btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: auto;
}
.coll-btn-add:hover {
  background: #1d4ed8;
}

/* Quick Receive Collapsible Bar */
.coll-quick-receive {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}
.coll-quick-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
}
.coll-quick-header:hover {
  background: #e0f2fe;
}
.coll-quick-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #1d4ed8;
}
.coll-quick-lightning {
  font-size: 15px;
  color: #eab308;
}
.coll-quick-chevron {
  font-size: 13px;
  font-weight: 700;
  color: #2563eb;
  transition: transform 0.2s ease;
}
.coll-quick-chevron.expanded {
  transform: rotate(180deg);
}
.coll-quick-body {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px dashed #bfdbfe;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Legend Row */
.coll-legend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 10px 0;
  font-size: 12px;
  color: #64748b;
}
.coll-legend-items {
  display: flex;
  align-items: center;
  gap: 16px;
}
.coll-legend-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}
.coll-legend-box {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}
.box-paid {
  background: #16a34a;
  color: #ffffff;
}
.box-pending {
  background: #ffffff;
  border: 1px solid #cbd5e1;
}
.box-partial {
  background: #f59e0b;
  color: #ffffff;
}
.coll-legend-rule {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

/* Unified Customer Cards List */
.coll-cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cust-compact-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 6px;
}
.cust-compact-card:hover {
  border-color: #cbd5e1;
}
.cust-compact-card.card-expanded {
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(37,99,235,0.06);
}
.cust-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  gap: 8px;
}
.cust-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.cust-id-prefix {
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  min-width: 24px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  letter-spacing: -0.3px;
}
.cust-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12.5px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.cust-info-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  overflow: hidden;
}
.cust-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
  row-gap: 2px;
}
.cust-name {
  font-weight: 750;
  font-size: 14.5px;
  color: #0f172a !important;
  text-decoration: none !important;
  cursor: pointer;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  max-width: none !important;
  flex-shrink: 1;
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: rgba(30, 64, 175, 0.12);
  touch-action: manipulation;
  display: inline-block;
  padding: 2px 0;
  min-height: 28px;
  line-height: 1.4;
}
.cust-name:hover {
  color: #1e293b !important;
  text-decoration: underline !important;
}
.badge-partial-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #f59e0b;
  font-size: 10.5px;
  padding: 1px 6px;
  font-weight: 700;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.2px;
}
.cust-loan-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: #dbeafe;
  color: #1e40af;
  flex-shrink: 0;
}
.cust-sub-details {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cust-financial-terms {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 6px;
}
.cust-bal-payable {
  font-weight: 700;
  background: #fffbeb;
  color: #b45309;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #fde68a;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.cust-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  flex-shrink: 0;
  min-width: 72px;
  margin-left: 4px;
}
.cust-paid-stat {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}
.cust-progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cust-bar-bg {
  width: 54px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.cust-bar-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 999px;
}
.cust-pct-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #16a34a;
  min-width: 26px;
  text-align: right;
}
.cust-chevron-icon {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  transition: transform 0.2s ease;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 14px;
  margin-top: 2px;
}
.cust-chevron-icon.rotated {
  transform: rotate(180deg);
  color: #1e40af;
}

.coll-btn-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
  height: 38px;
}
.coll-btn-shortcut:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

@media (max-width: 680px) {
  .cust-card-header {
    padding: 8px 12px;
    gap: 8px;
  }
  .cust-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .cust-id-prefix {
    font-size: 12.5px;
    min-width: 20px;
  }
  .cust-name {
    font-size: 13.5px;
    max-width: none !important;
    white-space: normal !important;
    color: #0f172a !important;
    text-decoration: none !important;
    -webkit-tap-highlight-color: rgba(30, 64, 175, 0.12);
    touch-action: manipulation;
    padding: 3px 0;
    min-height: 30px;
  }
  .cust-name-row {
    flex-wrap: wrap;
    row-gap: 2px;
    column-gap: 4px;
  }
  .cust-sub-details {
    font-size: 11px;
  }
  .cust-financial-terms {
    font-size: 11px;
  }
  .cust-bar-bg {
    width: 44px;
  }
  .coll-btn-add {
    margin-left: 0;
  }
}

/* 4-Row Checkbox Matrix */
.cust-card-expanded-body {
  padding: 8px 12px 10px 12px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
}
.sched-4row-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 4px;
}
.sched-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.sched-num-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #64748b;
}
.sched-box-btn {
  width: 100%;
  max-width: 32px;
  aspect-ratio: 1;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: transparent;
}
.sched-box-btn.is-paid,
.sched-box-btn.sched-box-paid {
  background: #16a34a !important;
  border-color: #15803d !important;
  color: #ffffff !important;
}
.sched-box-btn.is-partial,
.sched-box-btn.sched-box-partial {
  background: #f59e0b !important;
  border-color: #d97706 !important;
  color: #ffffff !important;
  padding: 0 1px;
}
.sched-box-btn.is-partial:hover {
  background: #d97706 !important;
}
.sched-partial-amt {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  letter-spacing: -0.3px;
  white-space: nowrap;
  max-width: 100%;
}
.sched-partial-currency {
  font-size: 8px;
  font-weight: 700;
  margin-right: 0.5px;
  opacity: 0.92;
}
.sched-box-btn.is-pending,
.sched-box-btn.sched-box-pending {
  background: #ffffff;
  border-color: #cbd5e1;
  color: transparent;
}
.sched-box-btn.is-pending:hover,
.sched-box-btn.sched-box-pending:hover {
  background: #eff6ff;
  border-color: #2563eb;
}

/* Overdue Instalment Box in Schedule Grid */
.sched-box-btn.is-overdue,
.sched-box-btn.sched-box-overdue {
  background: #fef2f2 !important;
  border: 1.5px solid #ef4444 !important;
  color: #dc2626 !important;
  font-weight: 900 !important;
  font-size: 13px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.sched-box-btn.is-overdue:hover {
  background: #fee2e2 !important;
  border-color: #b91c1c !important;
}
.sched-box-btn.is-overdue.is-next-due {
  border: 2px solid #ef4444 !important;
  box-shadow: 0 0 0 2.5px rgba(239, 68, 68, 0.35) !important;
  animation: pulseOverdueDue 2s infinite ease-in-out;
}
@keyframes pulseOverdueDue {
  0%, 100% { box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 4.5px rgba(239, 68, 68, 0.55); }
}

.sched-legend-box.overdue {
  background: #fef2f2;
  border: 1.5px solid #ef4444;
  color: #dc2626;
  font-weight: 900;
}

/* Feature 2: High-contrast Blue Outline on Next Due Week */
.sched-box-btn.is-next-due {
  border: 2px solid #2563eb !important;
  font-weight: 900 !important;
  animation: pulseNextDue 2s infinite ease-in-out;
}
.sched-box-btn.is-pending.is-next-due {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 2px solid #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25) !important;
}
/* Partial Checkbox: Show pure orange color only - NO blue line, border, or glow! */
.sched-box-btn.is-partial,
.sched-box-btn.sched-box-partial,
.sched-box-btn.is-partial.is-next-due,
.sched-box-btn.sched-box-partial.is-next-due {
  background: #f59e0b !important;
  color: #ffffff !important;
  border: 1.5px solid #d97706 !important;
  box-shadow: none !important;
  animation: none !important;
}
.sched-box-btn.is-partial:hover,
.sched-box-btn.is-partial.is-next-due:hover {
  background: #d97706 !important;
  border-color: #b45309 !important;
}
.sched-box-btn.is-partial .sched-partial-amt,
.sched-box-btn.is-partial .sched-partial-currency,
.sched-box-btn.is-partial.is-next-due .sched-partial-amt,
.sched-box-btn.is-partial.is-next-due .sched-partial-currency {
  color: #ffffff !important;
}
@keyframes pulseNextDue {
  0%, 100% { box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25); }
  50% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.45); }
}

/* Feature 3: Jump Highlight Flash Animation on Card Search */
.card-jump-flash {
  animation: jumpCardFlash 1.6s ease-out;
}
@keyframes jumpCardFlash {
  0% { transform: scale(1.02); box-shadow: 0 0 0 4px #3b82f6; }
  50% { transform: scale(1.01); box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.4); }
  100% { transform: scale(1); box-shadow: none; }
}

/* Feature 4: Long-Press Inline Partial Slider Popup (Dark Slate Fintech Theme) */
.inline-partial-slider-popup {
  position: fixed;
  background: #0f172a;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 99999;
  white-space: nowrap;
  font-size: 11.5px;
  font-family: inherit;
  animation: popInSlider 0.15s ease-out;
}
@keyframes popInSlider {
  0% { opacity: 0; transform: translateY(4px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.inline-partial-slider-popup::after {
  content: '';
  position: absolute;
  left: var(--arrow-x, 50%);
  transform: translateX(-50%);
  border-style: solid;
}
.inline-partial-slider-popup:not(.is-flipped)::after {
  bottom: -6px;
  border-width: 6px 6px 0;
  border-color: #0f172a transparent transparent;
}
.inline-partial-slider-popup.is-flipped::after {
  top: -6px;
  border-width: 0 6px 6px;
  border-color: transparent transparent #0f172a;
}
.inline-partial-slider-popup .slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline-partial-slider-popup input[type=range] {
  width: 95px;
  accent-color: #f59e0b;
  cursor: pointer;
}
.inline-partial-slider-popup .slider-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.inline-partial-slider-popup .btn-slider-save {
  background: #16a34a;
  color: #ffffff;
  border: none;
  font-weight: 800;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.inline-partial-slider-popup .btn-slider-cancel {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 11px;
  cursor: pointer;
}

/* Feature 5 & 6: Rapid Floating Undo & WhatsApp Slip Toast */
#rapid-collection-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#rapid-collection-toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.toast-wa-btn {
  background: #25D366;
  color: #ffffff;
  border: none;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.toast-wa-btn:hover {
  background: #20ba5a;
}
.toast-undo-btn {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 6px !important;
  font-weight: 800 !important;
  font-size: 11.5px !important;
  padding: 5px 11px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12) !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
}
.toast-undo-btn:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #000000 !important;
  transform: translateY(-1px);
}

#app-toast {
  display: none;
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  z-index: 100005 !important;
  max-width: 90vw;
  text-align: center;
  border: 1.5px solid #38bdf8;
  pointer-events: none;
  animation: toastFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#app-toast:empty {
  display: none !important;
}

@keyframes toastFadeIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.sched-box-btn:disabled, .sched-box-btn.is-locked {
  opacity: 0.42 !important;
  cursor: not-allowed !important;
  border-color: #cbd5e1 !important;
  box-shadow: none !important;
}

/* Collaborative Edit Lock Alert Banner */
.sched-lock-alert {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  color: #92400e;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.1);
  animation: fadeInLockAlert 0.25s ease-out;
}

@keyframes fadeInLockAlert {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.lock-alert-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.lock-alert-content {
  flex: 1;
}

.lock-alert-title {
  font-weight: 700;
  font-size: 13.5px;
  color: #78350f;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lock-alert-sub {
  font-size: 12px;
  color: #b45309;
  margin-top: 3px;
  line-height: 1.35;
}

.lock-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid #f59e0b;
  border-top-color: transparent;
  border-radius: 50%;
  animation: lockSpin 0.9s linear infinite;
  flex-shrink: 0;
}

@keyframes lockSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 580px) {
  .sched-4row-grid {
    gap: 3px;
  }
  .sched-num-label {
    font-size: 9.5px;
  }
  .sched-box-btn {
    border-radius: 4px;
    font-size: 11px;
  }
  .sched-partial-amt {
    font-size: 8.5px;
    letter-spacing: -0.4px;
  }
  .sched-partial-currency {
    font-size: 7px;
  }
}

@media (max-width: 380px) {
  .sched-partial-amt {
    font-size: 7.5px;
  }
  .sched-partial-currency {
    display: none;
  }
}

/* ==========================================================================
   MODERN FINTECH ANALYTICS & INSIGHTS (SCREENSHOTS 1-5 FIDELITY)
   ========================================================================== */

.ana-header-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.ana-desktop-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 640px) {
  .ana-desktop-actions {
    display: none;
  }
}

.ana-period-section {
  margin-bottom: 18px;
}

.ana-section-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
}

.ana-segmented-control {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 9999px;
  padding: 3px;
  gap: 3px;
  max-width: 100%;
  overflow-x: auto;
}

.ana-period-btn, .ana-fin-btn {
  border: none;
  background: transparent;
  border-radius: 9999px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ana-period-btn:hover, .ana-fin-btn:hover {
  color: #1e293b;
}

.ana-period-btn.active, .ana-fin-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* 4 Hero KPI Cards */
.ana-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

@media (max-width: 960px) {
  .ana-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 440px) {
  .ana-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

.ana-kpi-card {
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 96px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ana-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

.ana-kpi-blue {
  background: #eff6ff;
  border: 1px solid #dbeafe;
}
.ana-kpi-green {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.ana-kpi-purple {
  background: #faf5ff;
  border: 1px solid #e9d5ff;
}
.ana-kpi-amber {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.ana-kpi-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.ana-kpi-icon {
  font-size: 15px;
}

.ana-kpi-blue .ana-kpi-title { color: #2563eb; font-weight: 600; font-size: 12.5px; }
.ana-kpi-blue .ana-kpi-val { color: #1d4ed8; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }

.ana-kpi-green .ana-kpi-title { color: #16a34a; font-weight: 600; font-size: 12.5px; }
.ana-kpi-green .ana-kpi-val { color: #15803d; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.ana-kpi-green .ana-kpi-sub { color: #166534; font-size: 11px; font-weight: 500; margin-top: 3px; }

.ana-kpi-purple .ana-kpi-title { color: #9333ea; font-weight: 600; font-size: 12.5px; }
.ana-kpi-purple .ana-kpi-val { color: #7e22ce; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }

.ana-kpi-amber .ana-kpi-title { color: #ea580c; font-weight: 600; font-size: 12.5px; }
.ana-kpi-amber .ana-kpi-val { color: #c2410c; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }

/* Subnavigation Filter Chips */
.ana-subnav-wrap {
  margin-bottom: 20px;
}

.ana-subnav-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.ana-subnav-pills::-webkit-scrollbar {
  display: none;
}

.ana-subnav-pills.mini {
  gap: 6px;
}

.ana-subnav-btn {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  border-radius: 9999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.ana-subnav-pills.mini .ana-subnav-btn {
  padding: 5px 12px;
  font-size: 12px;
}

.ana-subnav-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.ana-subnav-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.15);
}

/* Layout Stack */
.ana-layout-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 18px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .ana-layout-stack {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    gap: 14px !important;
  }
  .ana-card,
  .ana-accordion-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

.ana-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.ana-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.ana-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.ana-card-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.ana-badge-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 3px 10px;
  border-radius: 9999px;
}

.ana-calendar-icon {
  font-size: 18px;
}

/* Weekly Bar Chart */
.ana-trend-bars {
  height: 160px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 2px 0 2px;
}

.ana-bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
}

.ana-bar-amt {
  font-size: 10px;
  font-weight: 700;
  color: #2563eb;
  min-height: 14px;
  line-height: 14px;
  white-space: nowrap;
}

.ana-bar-slot {
  width: 100%;
  height: 110px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: #f8fafc;
  border-radius: 8px;
  padding: 2px 1px;
}

.ana-bar-fill-elem {
  width: 100%;
  max-width: 32px;
  border-radius: 6px 6px 0 0;
  transition: height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.ana-bar-fill-elem.is-past {
  background: #93c5fd;
}

.ana-bar-fill-elem.is-now {
  background: #2563eb;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.ana-bar-label {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 600;
  min-height: 14px;
  line-height: 14px;
}

/* Metric Rows */
.ana-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 12px 0;
}

.ana-row-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13.5px;
}

.ana-metric-label {
  color: #475569;
  font-weight: 500;
}

.ana-metric-value {
  font-weight: 700;
  color: #0f172a;
}

.text-green { color: #16a34a !important; }
.text-amber { color: #c2410c !important; }
.text-blue { color: #2563eb !important; }
.text-purple { color: #7e22ce !important; }
.text-red { color: #dc2626 !important; }
.text-teal { color: #0d9488 !important; }

/* Accordions */
.ana-accordion-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.ana-accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.ana-acc-left {
  display: flex;
  flex-direction: column;
}

.ana-acc-title {
  font-size: 15.5px;
  font-weight: 700;
  color: #0f172a;
}

.ana-acc-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.ana-acc-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ana-acc-highlight {
  font-size: 15px;
  font-weight: 700;
}

.ana-chevron {
  font-size: 16px;
  color: #64748b;
  transition: transform 0.2s ease;
  display: inline-block;
}

.ana-chevron.open {
  transform: rotate(180deg);
}

.ana-accordion-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.ana-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.ana-breakdown-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}

.ana-bb-label {
  display: block;
  font-size: 11.5px;
  color: #64748b;
  margin-bottom: 4px;
}

.ana-bb-val {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

/* Loan Status Progress Bars */
.ana-status-bars-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.ana-status-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ana-sbar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.ana-sbar-title {
  color: #334155;
  font-weight: 600;
}

.ana-sbar-count {
  font-weight: 700;
  color: #0f172a;
}

.ana-sbar-track {
  height: 7px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.ana-sbar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.bg-blue { background: #2563eb !important; }
.bg-green { background: #16a34a !important; }
.bg-amber { background: #d97706 !important; }
.bg-red { background: #dc2626 !important; }

.ana-pill-action-btn {
  width: 100%;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 9999px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.ana-pill-action-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Route & Area Performance */
.ana-filter-select-wrap {
  margin-bottom: 14px;
}

.ana-select {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: #1e293b;
  background: #ffffff;
  cursor: pointer;
}

.ana-routes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ana-route-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
}

.ana-route-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.ana-route-name {
  font-weight: 700;
  font-size: 14.5px;
  color: #0f172a;
}

.ana-route-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}

.ana-route-badge.is-high {
  background: #dcfce7;
  color: #15803d;
}

.ana-route-badge.is-mid {
  background: #dbeafe;
  color: #1d4ed8;
}

.ana-route-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
}

.ana-route-track {
  height: 6px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.ana-route-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.ana-route-bottom {
  font-size: 11.5px;
  color: #64748b;
}

/* Follow-up Alerts */
.ana-followup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.ana-followup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ana-followup-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.ana-fu-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.bg-soft-amber { background: #fef3c7; color: #b45309; }
.bg-soft-red { background: #fee2e2; color: #b91c1c; }
.bg-soft-green { background: #dcfce7; color: #15803d; }
.bg-soft-blue { background: #eff6ff; color: #2563eb; }
.bg-soft-purple { background: #faf5ff; color: #7e22ce; }

.ana-fu-content {
  flex: 1;
}

.ana-fu-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
}

.ana-fu-sub {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 1px;
}

.ana-fu-count {
  font-size: 16px;
  font-weight: 800;
}

.ana-followup-item.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.15);
}

/* Follow-up Customers List */
.ana-followup-customers-container {
  margin-top: 14px;
  margin-bottom: 14px;
  border-top: 1px solid #f1f5f9;
  padding-top: 14px;
}

.ana-fu-header-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ana-followup-customers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 2px;
}

.ana-fu-cust-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.ana-fu-cust-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.ana-fu-cust-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ana-fu-cust-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.ana-fu-cust-prefix {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

.ana-fu-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ana-fu-name-block {
  min-width: 0;
  flex: 1;
}

.ana-fu-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ana-fu-cust-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.ana-fu-loan-tag {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
}

.ana-fu-sub-meta {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}

.ana-fu-cust-right {
  flex-shrink: 0;
}

.ana-fu-open-btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ana-fu-open-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.ana-fu-financial-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  font-size: 11.5px;
}

.ana-fu-fin-col {
  display: flex;
  flex-direction: column;
}

.ana-fu-fin-label {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
}

.ana-fu-fin-val {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 1px;
}

.ana-fu-empty-state {
  text-align: center;
  padding: 20px 14px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}

@keyframes highlightGlowAnim {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  50% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.highlight-glow {
  animation: highlightGlowAnim 1.5s ease-in-out infinite;
  border-color: #2563eb !important;
}

@media (max-width: 640px) {
  .ana-fu-financial-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
}

/* Financial Overview */
.ana-hero-box {
  background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 16px 18px;
  margin: 14px 0;
}

.ana-hero-box-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #2563eb;
  margin-bottom: 4px;
}

.ana-hero-box-amount {
  font-size: 26px;
  font-weight: 800;
  color: #1e40af;
  letter-spacing: -0.5px;
}

.ana-hero-box-target {
  font-size: 12.5px;
  color: #475569;
  margin: 6px 0 8px 0;
}

.ana-hero-progress-track {
  height: 8px;
  background: #dbeafe;
  border-radius: 9999px;
  overflow: hidden;
}

.ana-hero-progress-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.ana-hero-progress-sub {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 6px;
}

.ana-fin-subgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.ana-fin-subcard {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
}

.ana-fsub-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.ana-fsub-icon {
  font-size: 14px;
}

.ana-fsub-label {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 500;
}

.ana-fsub-val {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.ana-disclaimer {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  margin-top: 6px;
}

/* Summary Details Accordions & Quick Actions */
.ana-accordion-card.nested {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
}

.ana-acc-icon-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ana-acc-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.ana-summary-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ana-sum-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.ana-sum-label {
  color: #64748b;
}

.ana-sum-val {
  font-weight: 700;
  color: #0f172a;
}

.ana-quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.ana-quick-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 18px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ana-quick-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  border-color: #cbd5e1;
}

.ana-qc-icon {
  font-size: 22px;
  margin-bottom: 8px;
}

.ana-qc-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.ana-qc-sub {
  font-size: 12px;
  color: #64748b;
}

@media print {
  .ana-desktop-actions,
  .ana-period-section,
  .ana-subnav-wrap,
  .ana-pill-action-btn,
  #ana-module-quick-actions {
    display: none !important;
  }
  .ana-layout-stack {
    display: block !important;
  }
  .ana-card, .ana-accordion-card {
    page-break-inside: avoid;
    margin-bottom: 20px;
  }
}

/* Customer Search & Filter Toolbar */
.cust-search-toolbar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cust-search-toolbar select.form-control {
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  color: #1e293b;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cust-search-toolbar select.form-control:focus {
  background-color: #ffffff;
  border-color: #2563eb;
  outline: none;
}

/* Locked Form Field Styles for Ledger Safety */
.form-control-locked,
input.form-control:read-only.locked-field,
input.form-control:disabled.locked-field {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  border-color: #cbd5e1 !important;
  cursor: not-allowed !important;
}

/* Quick Action Toolbar in Expanded Customer Card */
.sched-quick-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .sched-quick-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .sched-quick-toolbar > div:last-child {
    display: flex;
    justify-content: stretch;
  }
  .sched-quick-toolbar > div:last-child button {
    flex: 1;
  }
}

/* ========================================================
   ENTERPRISE MICROFINANCE PRO SUITE STYLES
   ======================================================== */

/* 1. Borrower Credit Health Star Badges */
.credit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.credit-badge-prime {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #86efac;
}

.credit-badge-good {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.credit-badge-fair {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.credit-badge-risk {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

/* 2. Borrower Photo & KYC Badges */
.cust-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.kyc-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kyc-badge:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.kyc-badge-unverified {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

/* 3. Guarantor Pill */
.guar-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 2px 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.guar-pill:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

/* 4. Thermal Printer ESC/POS Receipt View (58mm Roll) */
.thermal-receipt-paper {
  background: #ffffff;
  color: #000000;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.35;
  width: 300px;
  max-width: 100%;
  margin: 0 auto;
  padding: 18px 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  border-top: 3px dashed #cbd5e1;
  border-bottom: 3px dashed #cbd5e1;
  user-select: text;
}

.thermal-receipt-paper h4 {
  font-size: 15px;
  font-weight: 900;
  text-align: center;
  margin: 0 0 2px 0;
  letter-spacing: 0.5px;
}

.thermal-receipt-paper .thermal-sub {
  font-size: 11px;
  text-align: center;
  color: #334155;
  margin-bottom: 8px;
}

.thermal-receipt-paper .thermal-divider {
  border-bottom: 1px dashed #000000;
  margin: 8px 0;
}

.thermal-receipt-paper .thermal-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
}

.thermal-receipt-paper .thermal-row-bold {
  display: flex;
  justify-content: space-between;
  margin: 5px 0;
  font-weight: 900;
  font-size: 13px;
}

.thermal-receipt-paper .thermal-barcode {
  text-align: center;
  font-size: 20px;
  letter-spacing: 4px;
  margin-top: 8px;
}

/* 5. Official No Objection Certificate (NOC) Sheet */
.noc-certificate-sheet {
  background: #fffdfa;
  border: 6px double #b45309;
  border-radius: 8px;
  padding: 36px 32px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  color: #1e293b;
  position: relative;
  font-family: 'Georgia', 'Times New Roman', serif;
}

.noc-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 58px;
  font-weight: 900;
  color: rgba(180, 83, 9, 0.06);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 6px;
  text-transform: uppercase;
  z-index: 0;
}

.noc-header {
  text-align: center;
  position: relative;
  z-index: 1;
  border-bottom: 2px solid #d97706;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.noc-title {
  font-size: 22px;
  font-weight: 900;
  color: #78350f;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.noc-subtitle {
  font-size: 13px;
  color: #92400e;
  font-style: italic;
}

.noc-cert-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #475569;
  font-family: sans-serif;
  margin-bottom: 20px;
  padding: 8px 12px;
  background: #fef3c7;
  border-radius: 6px;
}

.noc-body-text {
  font-size: 14.5px;
  line-height: 1.75;
  color: #334155;
  text-align: justify;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.noc-terms-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 28px;
  font-family: sans-serif;
  font-size: 13px;
  position: relative;
  z-index: 1;
}

.noc-signatures {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 36px;
  padding-top: 14px;
  position: relative;
  z-index: 1;
}

.noc-sign-box {
  text-align: center;
  width: 180px;
  font-family: sans-serif;
}

.noc-sign-line {
  border-top: 1.5px solid #0f172a;
  margin-bottom: 6px;
}

.noc-seal-emblem {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px dashed #b45309;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #b45309;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
  margin: 0 auto;
}

.badge-settled {
  background: #f5f3ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Print Overrides for Thermal Slip and NOC */
@media print {
  body.printing-thermal * {
    visibility: hidden;
  }
  body.printing-thermal #thermal-slip-preview,
  body.printing-thermal #thermal-slip-preview * {
    visibility: visible;
  }
  body.printing-thermal #thermal-slip-preview {
    position: fixed;
    left: 0;
    top: 0;
    width: 58mm !important;
    margin: 0 !important;
    padding: 3mm !important;
    box-shadow: none !important;
    border: none !important;
    background: #fff !important;
    color: #000 !important;
  }

  body.printing-noc * {
    visibility: hidden;
  }
  body.printing-noc #noc-certificate-container,
  body.printing-noc #noc-certificate-container * {
    visibility: visible;
  }
  body.printing-noc #noc-certificate-container {
    position: fixed;
    left: 0;
    top: 0;
    width: 100% !important;
    box-shadow: none !important;
    background: #fff !important;
  }
}

/* ========================================================
   CUSTOMER 3-DOT MORE OPTIONS MENU & BOTTOM SHEET
   ======================================================== */
.btn-cust-3dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-cust-3dot:hover,
.btn-cust-3dot:active {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.cust-actions-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 99998;
  animation: fadeIn 0.15s ease;
}

.cust-actions-popover {
  position: fixed;
  z-index: 99999;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  padding: 0;
  color: #1e293b;
}

@media (max-width: 768px) {
  .cust-actions-popover {
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 85vh !important;
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3) !important;
    animation: tooltipFadeIn 0.18s ease-out !important;
  }
}

@media (min-width: 769px) {
  .cust-actions-popover {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 92% !important;
    max-width: 440px !important;
    max-height: 85vh !important;
    border-radius: 16px !important;
    animation: tooltipFadeIn 0.15s ease-out !important;
  }
}

.cust-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.cust-menu-body {
  padding: 10px 14px 18px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 70vh;
}

.cust-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
}

.cust-menu-item:hover,
.cust-menu-item:active {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.cust-menu-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.cust-menu-item-title {
  font-size: 13.5px;
  font-weight: 750;
  color: #0f172a;
}

.cust-menu-item-desc {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

/* ========================================================
   1. CUSTOMER PROFILE PHOTO LIGHTBOX
   ======================================================== */
.photo-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  z-index: 100005;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.photo-lightbox-card {
  background: #ffffff;
  border-radius: 20px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: tooltipFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.photo-lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
}

.photo-lightbox-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.photo-lightbox-img-wrap {
  width: 100%;
  max-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  margin-bottom: 14px;
}

.photo-lightbox-img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.photo-lightbox-meta {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ========================================================
   2. CUSTOMER DETAIL MODAL & MOBILE BOTTOM SHEET
   ======================================================== */
.cust-detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  z-index: 99990;
  animation: fadeIn 0.18s ease-out;
}

.cust-detail-modal {
  position: fixed;
  z-index: 99992;
  background: #ffffff;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.4);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
}

/* Desktop: Centered dialog modal */
@media (min-width: 769px) {
  .cust-detail-modal {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 94%;
    max-width: 920px;
    max-height: 90vh;
    border-radius: 18px;
    border: 1px solid #cbd5e1;
    animation: tooltipFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

/* Mobile: Near-full-screen Bottom Sheet */
@media (max-width: 768px) {
  .cust-detail-modal {
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-height: 94vh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
    animation: tooltipFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .cust-detail-sheet-handle {
    width: 44px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 999px;
    margin: 8px auto 4px auto;
    display: block;
  }
}

.cust-detail-header {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cust-detail-loan-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 18px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  scrollbar-width: thin;
}

.cust-loan-tab-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.cust-loan-tab-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.cust-loan-tab-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.cust-detail-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.cust-detail-footer {
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ========================================================
   3. OFFLINE SYNC BADGES & TOASTS
   ======================================================== */
.offline-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.offline-sync-pill.online {
  background: #f0fdf4;
  color: #166534;
  border-color: #86efac;
}

.offline-sync-pill.pending {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.offline-sync-pill.offline {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fca5a5;
}

/* ========================================================
   4. OPERATOR COLLECTIONS BREAKDOWN (DASHBOARD)
   ======================================================== */
.collector-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.collector-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.collector-card.admin-collector {
  border-left: 4px solid #7c3aed;
  background: #faf5ff;
}

.collector-card.field-collector {
  border-left: 4px solid #2563eb;
  background: #f8fafc;
}

.collector-card-title {
  font-size: 14px;
  font-weight: 750;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.collector-card-amount {
  font-size: 20px;
  font-weight: 800;
  color: #15803d;
}

.collector-card-meta {
  font-size: 11.5px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.collector-card-actions {
  margin-top: 4px;
  display: flex;
  gap: 6px;
}

/* Mobile Top Header: Hide Install App Button */
@media (max-width: 768px) {
  #btn-install-pwa {
    display: none !important;
  }
}

/* Field Collectors Roster Responsive Layout */
.roster-desktop-view {
  display: block;
}
.roster-mobile-view {
  display: none;
}

@media (max-width: 768px) {
  .roster-desktop-view {
    display: none !important;
  }
  .roster-mobile-view {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    padding: 8px;
  }
  .roster-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }
  .roster-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
  }
  .roster-card-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
  }
  .roster-card-email {
    font-size: 12px;
    font-family: monospace;
    color: #2563eb;
    margin-bottom: 6px;
    word-break: break-all;
  }
  .roster-card-details {
    display: flex;
    gap: 12px;
    font-size: 11.5px;
    color: #64748b;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }
  .roster-card-actions {
    display: flex;
    gap: 8px;
    border-top: 1px solid #f1f5f9;
    padding-top: 8px;
  }
}

/* READ-ONLY VIEWER STYLING */
#viewer-readonly-banner {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.badge-readonly {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
}
