/* ==========================================================================
   হিসাব খাতা - সিনিয়র বিজনেস ম্যানেজার (ডিজাইন সিস্টেম ও লেআউট)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --primary: #101a57;
  --primary-light: #eaedf8;
  --primary-dark: #0a1038;
  
  --income: #0284c7;
  --income-bg: #eff6ff;
  --expense: #ef4444;
  --expense-bg: #fef2f2;
  --bank: #101a57;
  --bank-bg: #eff6ff;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --purple: #8b5cf6;
  --purple-bg: #f5f3ff;
  
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  
  --font-family: 'Hind Siliguri', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --base-font-size: 16px;
  --nav-height: 68px;
  --header-height: 65px;
}

/* Senior Mode: Enhanced Contrast & Bigger Font */
body.senior-mode {
  --base-font-size: 16px;
  --text-main: #000000;
  --text-muted: #334155;
  --border-color: #cbd5e1;
}

body.senior-mode .btn {
  font-size: 0.92rem;
  font-weight: 600;
}

body.senior-mode .form-control {
  font-size: 1rem;
  font-weight: 500;
}

body.senior-mode .nav-item span {
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  white-space: nowrap;
}

body.senior-mode .stat-number {
  font-size: 1.7rem !important;
  font-weight: 800 !important;
}

/* Dark Mode Support (True Matte OLED / AMOLED Black) */
body.dark-mode {
  --bg-primary: #000000;
  --bg-surface: #0a0a0a;
  --bg-card: #121212;
  --bg-card-subtle: #181818;
  --text-main: #ffffff;
  --text-muted: #a1a1aa;
  --text-light: #71717a;
  --border-color: #222222;
  
  --primary-light: #eaedf8;
  --income: #0284c7;
  --income-bg: #eff6ff;
  --expense: #f87171;
  --expense-bg: rgba(239, 68, 68, 0.12);
  --bank: #60a5fa;
  --bank-bg: rgba(59, 130, 246, 0.12);
  --warning: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --purple: #a78bfa;
  --purple-bg: rgba(139, 92, 246, 0.12);
}

body.dark-mode.senior-mode {
  --text-main: #ffffff;
  --text-muted: #d4d4d8;
  --border-color: #333333;
}

/* Base Reset — Native PWA Touch Optimized */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* সকল ইন্টারেক্টিভ এলিমেন্টে নেটিভ টাচ বিহেভিয়ার */
button, a, [role="button"], .nav-item, .btn, .card, .modal-content {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

/* প্রেস করলে নেটিভ স্কেল ইফেক্ট */
button:active,
.btn:active,
.nav-item:active {
  transform: scale(0.97);
  transition: transform 0.08s ease;
}

/* হার্ডওয়্যার এক্সিলারেশন: স্মুথ অ্যানিমেশনের জন্য */
.app-header,
.bottom-nav,
.modal-overlay,
.modal-content,
.tab-pane,
.card,
.fab-btn,
.stat-card {
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

body {
  font-family: var(--font-family);
  font-size: var(--base-font-size);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: 0;
  padding-bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  /* iOS safe area পূর্ণ সাপোর্ট (iPhone Notch & Dynamic Island & Home Indicator) */
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  /* স্মুথ স্ক্রলিং ফিজিক্স (iOS Momentum) */
  -webkit-overflow-scrolling: touch;
}

/* Layout Wrapper */
.app-layout {
  display: block;
  min-height: 100vh;
  width: 100%;
}

/* Desktop Sidebar (Default Hidden on Mobile) */
.desktop-sidebar {
  display: none;
}

/* App Container */
.app-container {
  max-width: 650px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-primary);
  padding-bottom: 0;
  transition: max-width 0.3s ease;
}

/* ==========================================================================
   Tablet / iPad Responsive View (@media 641px to 991px)
   ========================================================================== */
@media (min-width: 641px) and (max-width: 991px) {
  .app-container {
    max-width: 820px;
    padding: 0 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 14px !important;
  }

  .stat-card.full-width {
    grid-column: span 3 !important;
  }

  .biz-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }

  .brick-stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }

  .bottom-nav {
    max-width: 820px !important;
    border-radius: 20px 20px 0 0;
  }

  .card-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* ==========================================================================
   Desktop / PC Responsive View (@media min-width: 992px)
   ========================================================================== */
@media (min-width: 992px) {
  body {
    padding-bottom: 0;
  }

  .app-layout {
    display: flex;
    max-width: 1440px;
    margin: 0 auto;
    background-color: var(--bg-primary);
  }

  /* পিসি সাইডবার দৃশ্যমান ও স্টিকি */
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    width: 290px;
    min-width: 290px;
    height: 100vh;
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 24px 18px;
    overflow-y: auto;
    z-index: 120;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
  }

  .sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #101a57, #101a57);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(16, 26, 87, 0.3);
  }

  .sidebar-brand-text h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
  }

  .sidebar-brand-text p {
    font-size: 0.88rem;
    color: var(--text-muted);
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
  }

  .sidebar-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    padding: 12px 14px !important;
    border-radius: var(--radius-md) !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: var(--text-muted) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    transition: all 0.2s ease !important;
    width: 100% !important;
    text-align: left !important;
  }

  .sidebar-item i {
    font-size: 1.4rem !important;
  }

  .sidebar-item:hover {
    background: var(--bg-card-subtle) !important;
    color: var(--text-main) !important;
  }

  .sidebar-item.active {
    background: var(--primary-light) !important;
    color: var(--primary-dark) !important;
    border-color: var(--primary) !important;
  }

  body.dark-mode .sidebar-item.active {
    background: rgba(16, 26, 87, 0.2) !important;
    color: #38bdf8 !important;
  }

  .sidebar-quick-action {
    margin: 20px 0 16px;
  }

  .sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
  }

  .sidebar-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
  }

  .sidebar-copyright {
    font-size: 0.78rem;
    color: var(--text-light);
    text-align: center;
  }

  /* পিসি ভিউতে মেইন কনটেইনারের বিস্তার */
  .app-container {
    flex: 1;
    max-width: none;
    margin: 0;
    padding: 0 30px 40px 30px;
    min-height: 100vh;
  }

  .app-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0 16px;
    margin-bottom: 16px;
  }

  .month-selector-bar {
    border-radius: var(--radius-md);
    margin-bottom: 24px;
  }

  /* পিসিতে ৪-কলামের স্ট্যাট গ্রিড */
  .stats-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
    margin-bottom: 24px !important;
  }

  .stat-card.full-width {
    grid-column: span 1 !important;
  }

  /* ভাটার ৬টি কার্ড ৩-কলাম x ২-সারি সুষম গ্রিড */
  .brick-stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  /* পিসিতে ড্যাশবোর্ড ২-কলাম স্প্লিট */
  .desktop-dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr;
    gap: 24px;
    align-items: start;
  }

  /* পিসিতে কার্ড লিস্ট গ্রিড ভিউ */
  #shopCardsList, #medicalCardsList, #staffCardsList, #bankAccountsList, #otherExpensesList, #brickSalesList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
  }

  /* পিসিতে মোবাইল বটম ন্যাভ ও ফ্যাব বাটন হাইড থাকবে */
  .bottom-nav, .fab-container {
    display: none !important;
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding-top: calc(13px + env(safe-area-inset-top, 0px));
  padding-bottom: 13px;
  padding-left: calc(18px + env(safe-area-inset-left, 0px));
  padding-right: calc(18px + env(safe-area-inset-right, 0px));
  min-height: calc(64px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
  will-change: transform;
}

.app-header.header-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.header-avatar {
  width: 40px;
  height: 40px;
  background: transparent !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none !important;
  box-shadow: none !important;
  transition: transform 0.2s ease;
}

.header-avatar:hover {
  transform: scale(1.05);
}

.header-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.header-title-box {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.header-title-box h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.header-title-box p {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hide-on-mobile {
  display: flex;
}

@media (max-width: 600px) {
  .app-header {
    padding-top: calc(11px + env(safe-area-inset-top, 0px));
    padding-bottom: 11px;
    padding-left: calc(14px + env(safe-area-inset-left, 0px));
    padding-right: calc(14px + env(safe-area-inset-right, 0px));
    min-height: calc(58px + env(safe-area-inset-top, 0px));
    gap: 8px;
  }

  .header-brand {
    gap: 8px;
  }

  .header-title-box h1 {
    font-size: 1.20rem;
  }

  .header-title-box p {
    font-size: 0.80rem;
  }

  .header-actions {
    gap: 6px;
  }

  .hide-on-mobile {
    display: none !important;
  }

  .cloud-sync-pill {
    width: 38px !important;
    height: 38px !important;
    font-size: 1.22rem !important;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    font-size: 1.18rem;
  }

  .header-avatar {
    width: 42px;
    height: 42px;
    font-size: 1.6rem;
  }

  .header-back-btn {
    width: 36px;
    height: 36px;
    font-size: 1.35rem;
    flex-shrink: 0;
  }
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 1px solid #a7f3d0;
  background: #f0f9ff;
  color: #101a57;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: #101a57;
  color: #101a57;
  background: #dbeafe;
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn.active {
  background: #dbeafe;
  color: #101a57;
  border-color: #101a57;
}

.icon-btn.voice-btn {
  background: #101a57 !important;
  color: #ffffff !important;
  border-color: #101a57 !important;
  box-shadow: 0 2px 6px rgba(16, 26, 87, 0.35);
}

body.dark-mode .icon-btn {
  background: rgba(16, 26, 87, 0.15) !important;
  border: 1px solid #101a57 !important;
  color: #38bdf8 !important;
}

body.dark-mode .icon-btn:hover {
  background: rgba(16, 26, 87, 0.3) !important;
  border-color: #0284c7 !important;
  color: #6ee7b7 !important;
}

body.dark-mode .icon-btn.active {
  background: rgba(16, 26, 87, 0.25) !important;
  color: #38bdf8 !important;
  border-color: #101a57 !important;
}

body.dark-mode .icon-btn.voice-btn {
  background: #0284c7 !important;
  color: #000000 !important;
  border-color: #0284c7 !important;
}

/* নোটিফিকেশন বাটন ও ব্যাজ */
.notif-btn {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-surface);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
  animation: pulse-badge 2s infinite ease-in-out;
}

body.dark-mode .notif-badge {
  border-color: #0a0a0a;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Cloud Sync Status Indicator - Styled like voice/notification buttons */
.cloud-sync-pill {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #101a57;
  color: #ffffff !important;
  font-size: 1.25rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: none !important;
}

.cloud-sync-pill:hover {
  background: #0a1038;
  transform: scale(1.05);
  box-shadow: none !important;
}

.cloud-sync-pill i {
  font-size: 1.25rem !important;
  display: inline-block !important;
  color: #ffffff !important;
  line-height: 1 !important;
}

.cloud-sync-pill.syncing {
  background: #f59e0b;
  box-shadow: none !important;
}
.cloud-sync-pill.syncing i {
  color: #ffffff !important;
  animation: spinSlow 1.2s linear infinite;
}

.cloud-sync-pill.offline {
  background: #64748b;
  box-shadow: none !important;
}
.cloud-sync-pill.offline i {
  color: #ffffff !important;
}

@media (max-width: 768px) {
  .cloud-sync-pill {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.15rem !important;
  }
  .cloud-sync-pill i {
    font-size: 1.15rem !important;
  }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   সেকশন হেডার ও টাইটেল স্টাইলিং (Executive Section Headers)
   ========================================================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 28px 0 14px 0;
  flex-wrap: nowrap;
  padding: 0 2px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  line-height: 1.2;
}

.section-title i {
  font-size: 1.15rem;
  color: #101a57;
  background: rgba(16, 26, 87, 0.1);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.dark-mode .section-title i {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

.section-action-btn {
  background: #eff6ff;
  color: #101a57;
  border: 1px solid #bfdbfe;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: none;
}

.section-action-btn:hover {
  background: #101a57;
  color: #ffffff;
  border-color: #101a57;
  transform: translateY(-1px);
}

.section-action-btn:active {
  transform: scale(0.96);
}

body.dark-mode .section-action-btn {
  background: #1e293b;
  color: #60a5fa;
  border-color: #334155;
}

body.dark-mode .section-action-btn:hover {
  background: #101a57;
  color: #ffffff;
  border-color: #101a57;
}

/* Month Filter Selector */
.month-selector-bar {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.month-nav-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.current-month-display {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Main Content Area */
.main-content {
  padding: 10px 16px 100px;
}

.tab-pane {
  display: none;
  opacity: 0;
  will-change: transform, opacity;
}

.tab-pane.active {
  display: block;
  animation: tabFluidIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* আল্ট্রা-স্মুথ অ্যাপল স্প্রিং ট্যাব ট্রানজিশন (iOS Fluid Physics) */
@keyframes tabFluidIn {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* সরল fadeIn অ্যানিমেশন (কার্ড, মডাল ইত্যাদির জন্য) */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* স্কেল পপ অ্যানিমেশন */
@keyframes scalePop {
  0% { transform: scale(0.94); opacity: 0; }
  60% { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Bottom Navigation Bar (Native App Style with Safe Area Support) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  max-width: 650px;
  margin: 0 auto;
  padding-left: 6px;
  padding-right: 6px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Mobile Bottom Navigation Item - Modern Native Underline Style */
.nav-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: none;
  color: #64748b;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 2px 8px 2px;
  border-radius: 0;
  box-shadow: none !important;
  transition: color 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  gap: 3px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-item i {
  font-size: 1.45rem;
  line-height: 1;
  color: #64748b;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.nav-item span {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  letter-spacing: -0.2px;
  line-height: 1.1;
  text-align: center;
  display: block;
  transition: color 0.2s ease;
}

/* Active State: No Box Background, Blue Text/Icon + Blue Indicator Line */
.nav-item.active {
  background: transparent !important;
  box-shadow: none !important;
  color: #101a57 !important;
}

.nav-item.active i {
  color: #101a57 !important;
  transform: translateY(-2px) scale(1.1);
}

.nav-item.active span {
  color: #101a57 !important;
  font-weight: 800 !important;
}

/* Blue Underline Indicator */
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3.5px;
  background: #101a57;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(16, 26, 87, 0.45);
  animation: navIndicatorSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes navIndicatorSlide {
  from { width: 8px; opacity: 0; }
  to { width: 24px; opacity: 1; }
}

/* Dark Mode Active State */
body.dark-mode .nav-item {
  color: #94a3b8;
}

body.dark-mode .nav-item i,
body.dark-mode .nav-item span {
  color: #94a3b8;
}

body.dark-mode .nav-item.active {
  background: transparent !important;
  box-shadow: none !important;
  color: #38bdf8 !important;
}

body.dark-mode .nav-item.active i,
body.dark-mode .nav-item.active span {
  color: #38bdf8 !important;
}

body.dark-mode .nav-item.active::after {
  background: #38bdf8;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.6);
}

.voice-banner-text h3,
.voice-banner-text h4 {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: #ffffff;
}

.voice-banner-text p {
  font-size: 0.84rem;
  color: #dbeafe;
  line-height: 1.2;
}

.voice-play-pill {
  flex-shrink: 0;
  background: #ffffff !important;
  color: #0a1038 !important;
  font-weight: 700 !important;
  border-radius: var(--radius-full) !important;
  padding: 8px 14px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.voice-play-pill:hover {
  transform: scale(1.04);
}

.voice-btn {
  background: linear-gradient(135deg, #eff6ff, #dbeafe) !important;
  color: #101a57 !important;
  border: 1px solid #0284c7 !important;
}

body.dark-mode .voice-assistant-banner,
body.dark-mode .voice-banner {
  background: linear-gradient(135deg, #043b2c, #02261c) !important;
  border-color: #0d5f3f;
}

body.dark-mode .voice-play-pill {
  background: #38bdf8 !important;
  color: #000000 !important;
}

body.dark-mode .voice-btn {
  background: #062b1e !important;
  color: #38bdf8 !important;
  border-color: #101a57 !important;
}

/* Print Styles for Receipts */
/* ==========================================================================
   ULTRA-PROFESSIONAL PRINT SYSTEM FOR ALL RECEIPTS & AUDIT MEMOS
   ========================================================================== */
@media print {
  @page {
    size: auto;
    margin: 12mm 10mm 12mm 10mm;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 13pt;
    line-height: 1.4;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide everything on screen except the modal content / printable receipt */
  .app-header,
  .bottom-nav,
  .fab-container,
  .month-selector-bar,
  .desktop-sidebar,
  .modal-header,
  .no-print,
  button,
  .modal-close {
    display: none !important;
  }

  .modal-overlay {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .modal-content {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    background: transparent !important;
  }

  #printableReceipt,
  .receipt-slip {
    box-shadow: none !important;
    margin: 0 auto !important;
    padding: 16px !important;
    page-break-inside: avoid !important;
  }

  /* Crisp table and borders for laser / inkjet printing */
  table, th, td {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}


/* Ensure crisp white text on all blue buttons, badges, and cards */
.btn-primary, .btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  color: #ffffff !important;
}
.btn-primary * {
  color: #ffffff !important;
}
.hero-balance-card, .screen-hero-card, .voice-record-circle.listening {
  color: #ffffff !important;
}
.hero-balance-card *, .screen-hero-card * {
  color: #ffffff !important;
}
.badge-primary, .tag-primary, .chip-primary, .tab-pill.active {
  color: #ffffff !important;
}


/* ==========================================================================
   GLOBAL BLUE THEME & WHITE TEXT CONTRAST ENFORCEMENT
   ========================================================================== */
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary * {
  color: #ffffff !important;
}

.hero-balance-card,
.screen-hero-card,
.stat-card.primary,
.nav-item.active,
.tab-pill.active,
.badge-primary,
.badge-income,
.tag-primary,
.chip-primary,
.chip.active,
.voice-record-circle.listening {
  color: #ffffff !important;
}

.hero-balance-card *,
.screen-hero-card * {
  color: #ffffff !important;
}

[style*="background: #101a57"],
[style*="background: #101a57"],
[style*="background: #0a1038"],
[style*="background: #0284c7"],
[style*="background: #0369a1"],
[style*="background:#101a57"],
[style*="background:#101a57"],
[style*="background:#0284c7"] {
  color: #ffffff !important;
}

[style*="background: #101a57"] *,
[style*="background: #101a57"] *,
[style*="background: #0a1038"] *,
[style*="background: #0284c7"] *,
[style*="background: #0369a1"] *,
[style*="background:#101a57"] *,
[style*="background:#101a57"] *,
[style*="background:#0284c7"] * {
  color: #ffffff !important;
}



/* Mobile Bottom Navigation Item Active State */
.nav-item {
  color: #64748b;
  border-radius: 12px;
}

.nav-item i {
  color: #64748b;
}

.nav-item.active {
  background: #101a57 !important;
  color: #ffffff !important;
  box-shadow: 0 3px 10px rgba(16, 26, 87, 0.35) !important;
}

.nav-item.active i,
.nav-item.active span {
  color: #ffffff !important;
  font-weight: 700 !important;
}

body.dark-mode .nav-item.active {
  background: #101a57 !important;
  color: #ffffff !important;
  box-shadow: 0 3px 10px rgba(16, 26, 87, 0.4) !important;
}

body.dark-mode .nav-item.active i,
body.dark-mode .nav-item.active span {
  color: #ffffff !important;
}

/* Sidebar Active Item */
.sidebar-item.active {
  background: #101a57 !important;
  color: #ffffff !important;
  border-color: #101a57 !important;
}

.sidebar-item.active i,
.sidebar-item.active span {
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* Tab Pills and Active Buttons */
.tab-pill.active,
.sub-tab.active,
.filter-pill.active,
.audio-cat-pill.active,
.speed-btn.active,
.zakat-cat-pill.active {
  background: #101a57 !important;
  color: #ffffff !important;
}

.tab-pill.active *,
.sub-tab.active *,
.filter-pill.active *,
.audio-cat-pill.active *,
.speed-btn.active *,
.zakat-cat-pill.active * {
  color: #ffffff !important;
}


/* ==========================================================================
   INTACTIC POWERED-BY BRANDING & LOGO SWITCHER (SMOOTH LIGHT/DARK TRANSITION)
   ========================================================================== */
.intactic-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(16, 26, 87, 0.06);
  border: 1px solid rgba(16, 26, 87, 0.16);
}

.intactic-brand-badge:hover {
  background: rgba(16, 26, 87, 0.12);
  border-color: rgba(16, 26, 87, 0.35);
  transform: translateY(-1px);
}

.intactic-brand-badge .brand-subtext {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0a1038;
  letter-spacing: 0.3px;
}

.intactic-logo-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
}

.intactic-logo {
  height: 19px;
  width: auto;
  max-width: 110px;
  object-fit: contain;
  vertical-align: middle;
  transition: opacity 0.35s ease, transform 0.35s ease;
  display: block;
}

.intactic-logo.logo-dark {
  display: none !important;
}

.intactic-logo.logo-light {
  display: block !important;
}

/* Smooth Dark Mode Switching */
body.dark-mode .intactic-brand-badge {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

body.dark-mode .intactic-brand-badge:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

body.dark-mode .intactic-brand-badge .brand-subtext {
  color: #cbd5e1;
}

body.dark-mode .intactic-logo.logo-light {
  display: none !important;
}

body.dark-mode .intactic-logo.logo-dark {
  display: block !important;
}

/* Apple Lock Screen Portal Styling */
.apple-auth-card .intactic-brand-badge {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  margin-top: 10px;
}

.apple-auth-card .intactic-brand-badge .brand-subtext {
  color: rgba(255, 255, 255, 0.75);
}

.apple-auth-card .intactic-logo.logo-light {
  display: none !important;
}

.apple-auth-card .intactic-logo.logo-dark {
  display: block !important;
}

/* Global App Footer */
.app-global-footer {
  display: none !important;
}

.app-global-footer .powered-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-powered-box {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* Settings ট্যাবে মান্থ সিলেক্টর বার লুকাও */
#tab-settings .month-selector-bar {
  display: none !important;
}

/* Dark mode month selector bar fix */
body.dark-mode .month-selector-bar {
  background: #111111;
  border-bottom: 1px solid #222222;
}
body.dark-mode .month-nav-btn {
  background: #1a1a1a;
  border-color: #333333;
  color: #e2e8f0;
}
body.dark-mode .current-month-display {
  color: #f1f5f9;
}


/* ==========================================================================
   সেন্টার এলিভেটেড ভয়েস ইনপুট বাটন ও মোবাইল নববার নচ (Center Floating Voice Button)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: calc(6px + env(safe-area-inset-left, 0px));
  padding-right: calc(6px + env(safe-area-inset-right, 0px));
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.07);
  max-width: 650px;
  margin: 0 auto;
}

body.dark-mode .bottom-nav {
  background: #0f1117;
  border-top: 1px solid #1e222e;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
}

/* Center Voice Button Container */
.nav-item-voice {
  flex: 1.15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  background: transparent !important;
  border: none;
  cursor: pointer;
  padding: 0 2px 4px;
  text-decoration: none;
  position: relative;
  z-index: 105;
  margin-top: -30px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.voice-center-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #101a57;
  color: #ffffff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
  border: 4px solid var(--bg-surface);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease;
  margin-bottom: 3px;
  position: relative;
}

body.dark-mode .voice-center-circle {
  background: #101a57;
  border: 4px solid #0f1117;
  box-shadow: none !important;
}

.voice-center-circle i {
  font-size: 1.85rem !important;
  color: #ffffff !important;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item-voice:hover .voice-center-circle {
  transform: scale(1.05);
  box-shadow: none !important;
}

.nav-item-voice:active .voice-center-circle {
  transform: scale(0.94);
  box-shadow: none !important;
}

.voice-center-label {
  font-size: 0.94rem !important;
  font-weight: 800 !important;
  color: #101a57 !important;
  -webkit-text-stroke: 0.45px #101a57;
  letter-spacing: 0.2px;
  line-height: 1.1;
  text-align: center;
  display: block;
}

body.dark-mode .voice-center-label {
  color: #60a5fa !important;
  -webkit-text-stroke: 0.45px #60a5fa;
}

/* Hide header voice button on mobile since bottom center button is primary */
@media (max-width: 768px) {
  .app-header .voice-btn {
    display: none !important;
  }
}

/* ==========================================================================
   ফ্লোটিং অ্যাকশন বাটন (FAB) — নতুন এন্ট্রি বাটন
   ========================================================================== */
.fab-container {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 14px);
  right: calc(18px + env(safe-area-inset-right, 0px));
  z-index: 200;
}

/* আরও (More) ও সেটিংস (Settings) ট্যাবে FAB সম্পূর্ণরূপে লুকানো থাকবে */
body:has(#tab-more.active) .fab-container,
body:has(#tab-settings.active) .fab-container,
#tab-more.active ~ .fab-container,
#tab-settings.active ~ .fab-container {
  display: none !important;
}

/* আরও (More) ট্যাবে স্ক্রোল সীমা একদম Intactic কার্ডে পারফেক্টলি শেষ হবে (কোনো বাড়তি ফাঁকা থাকবে না) */
#tab-more {
  margin-bottom: -50px !important;
  padding-bottom: 0 !important;
}

@media (min-width: 769px) {
  /* Desktop: FAB লুকানো থাকবে */
  .fab-container {
    display: none !important;
  }
}

.fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #101a57;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 4px 18px rgba(16, 26, 87, 0.45);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.fab-btn:hover {
  background: #101a57;
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(16, 26, 87, 0.55);
}

.fab-btn:active {
  transform: scale(0.95);
}

body.dark-mode .fab-btn {
  background: #101a57;
  box-shadow: 0 4px 18px rgba(16, 26, 87, 0.5);
}

/* ============================================================
   PWA নেটিভ ইনস্টল ব্যানার (Install Prompt Banner)
   ============================================================ */
.pwa-install-banner {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  width: calc(100% - 32px);
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(16, 26, 87, 0.18), 0 2px 8px rgba(0,0,0,0.08);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-install-banner.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.pwa-install-banner-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(16,26,87,0.18);
}

.pwa-install-banner-text {
  flex: 1;
  min-width: 0;
}

.pwa-install-banner-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.pwa-install-banner-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.pwa-install-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-install-btn {
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pwa-install-btn.primary {
  background: #101a57;
  color: #fff;
}

.pwa-install-btn.primary:active {
  transform: scale(0.95);
  background: #0a1038;
}

.pwa-install-btn.dismiss {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
}

.pwa-install-btn.dismiss:active {
  transform: scale(0.95);
}

body.dark-mode .pwa-install-banner {
  background: #1a1a2e;
  border-color: #2a2a4a;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

body.dark-mode .pwa-install-btn.dismiss {
  background: #252545;
  color: #a1a1aa;
}

/* ============================================================
   অফলাইন স্ট্যাটাস টোস্ট
   ============================================================ */
.pwa-offline-toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: #1e293b;
  color: #f8fafc;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.28);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  pointer-events: none;
}

.pwa-offline-toast.show {
  transform: translateX(-50%) translateY(0);
}

.pwa-offline-toast.online {
  background: #166534;
  color: #dcfce7;
}
