:root {
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-muted: #F1F5F9;
  --border-card: #E2E8F0;
  --text-main: #1E293B;
  --text-muted: #64748B;
}

html.dark {
  --bg-page: #0B1220;
  --bg-card: #131D31;
  --bg-muted: #1B2841;
  --border-card: #24334F;
  --text-main: #E2E8F0;
  --text-muted: #94A3B8;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  -webkit-tap-highlight-color: transparent;
}

/* Dark mode semantic overrides for Tailwind utility classes */
html.dark body { background-color: #0B1220 !important; color: #E2E8F0 !important; }
html.dark .bg-white { background-color: #131D31 !important; }
html.dark .bg-white\/95 { background-color: rgba(19, 29, 49, 0.95) !important; }
html.dark .bg-slate-50, html.dark .bg-slate-50\/70 { background-color: #17233A !important; }
html.dark .bg-slate-100 { background-color: #1E2C47 !important; }
html.dark .bg-navy-50, html.dark .bg-navy-50\/70 { background-color: #1B2B45 !important; }
html.dark .bg-teal-50, html.dark .bg-teal-50\/70, html.dark .bg-teal-50\/80 { background-color: rgba(15, 118, 110, 0.18) !important; }
html.dark .bg-amber-50, html.dark .bg-amber-50\/40 { background-color: rgba(245, 158, 11, 0.14) !important; }
html.dark .bg-rose-50, html.dark .bg-rose-50\/40, html.dark .bg-rose-50\/70 { background-color: rgba(225, 29, 72, 0.15) !important; }
html.dark .border-slate-200, html.dark .border-slate-200\/80, html.dark .border-slate-100, html.dark .border-slate-300 { border-color: #253552 !important; }
html.dark .border-navy-100 { border-color: #2E456B !important; }
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) { border-color: #1F2E4A !important; }
html.dark .text-slate-900, html.dark .text-slate-800 { color: #F1F5F9 !important; }
html.dark .text-slate-700, html.dark .text-slate-600 { color: #CBD5E1 !important; }
html.dark .text-slate-500, html.dark .text-slate-400 { color: #94A3B8 !important; }
html.dark .text-\[\#1E3A5F\] { color: #93C5FD !important; }
html.dark .text-\[\#0F766E\] { color: #5EEAD4 !important; }
html.dark input, html.dark select, html.dark textarea {
  background-color: #0F172A !important;
  color: #F8FAFC !important;
  border-color: #334155 !important;
}
html.dark .hover\:bg-slate-50:hover, html.dark .hover\:bg-slate-50\/80:hover, html.dark .hover\:bg-slate-100:hover {
  background-color: #1C2B47 !important;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #94A3B8; border-radius: 9999px; }

/* Desktop collapsed sidebar */
body.sidebar-collapsed #desktopSidebar { width: 4.75rem; }
body.sidebar-collapsed #appMainWrapper { padding-left: 4.75rem; }
body.sidebar-collapsed .sidebar-label { display: none !important; }
body.sidebar-collapsed .sidebar-collapse-center {
  justify-content: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}
@media (max-width: 1023px) {
  body.sidebar-collapsed #appMainWrapper { padding-left: 0 !important; }
}

/* Forced Mobile / Compact preview mode even on desktop screens */
body.force-mobile-mode #desktopSidebar { display: none !important; }
body.force-mobile-mode #desktopToolbar { display: none !important; }
body.force-mobile-mode #appMainWrapper { padding-left: 0 !important; }
body.force-mobile-mode #mobileBottomNav { display: block !important; }
body.force-mobile-mode #mobileMenuBtn { display: inline-flex !important; }
body.force-mobile-mode #mainContent { max-width: 540px !important; padding-bottom: 6.5rem !important; }

/* Safe Area for iPhone / Android Gesture Bar */
#mobileBottomNav {
  padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
}
.pb-safe {
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

/* Animations */
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.97) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.animate-fadeIn { animation: fadeInScale 0.18s ease-out; }

/* Print / PDF */
@media print {
  #desktopSidebar, #mobileBottomNav, #mobileDrawerOverlay, #topStickyHeader, #desktopToolbar,
  #toastContainer, #customModal, #importExcelModal, #pwaInstallModal, #authLandingScreen, .no-print {
    display: none !important;
  }
  #appMainWrapper { padding-left: 0 !important; }
  #mainContent { max-width: 100% !important; padding: 0 !important; }
  body { background: #ffffff !important; color: #0f172a !important; }
}
