/* Ecclesia ChMS - Enterprise SaaS Theme & Core Stylesheet */

:root {
  /* Master Theme: Deep Navy + Royal Blue + Teal Palette */
  --color-primary: #1E3A8A;           /* Deep Royal Blue */
  --color-primary-hover: #1D4ED8;     /* Royal Blue Hover */
  --color-primary-light: #DBEAFE;     /* Light Royal Blue Tint */
  --color-primary-container: #1E3A8A;
  --color-on-primary: #FFFFFF;
  
  --color-secondary: #0F766E;         /* Professional Teal */
  --color-secondary-hover: #0D9488;   /* Teal Hover */
  --color-secondary-light: #CCFBF1;   /* Light Teal Tint */
  --color-secondary-container: #0F766E;
  --color-on-secondary: #FFFFFF;

  /* Backgrounds */
  --color-bg: #F8FAFC;                /* Main Background */
  --color-card: #FFFFFF;              /* Card Background */
  --color-bg-secondary: #F1F5F9;      /* Secondary Background */
  --color-surface: #F8FAFC;
  --color-surface-container: #F1F5F9;

  /* Typography */
  --color-text-primary: #0F172A;      /* Primary Text */
  --color-text-secondary: #475569;    /* Secondary Text */
  --color-text-muted: #64748B;        /* Muted Text */

  /* Borders & Dividers */
  --color-border: #E2E8F0;            /* Subtle Border */
  --color-divider: #CBD5E1;           /* Divider */

  /* Status Colors */
  --color-success: #16A34A;           /* Green */
  --color-warning: #D97706;           /* Amber */
  --color-danger: #DC2626;            /* Red */
  --color-info: #2563EB;              /* Blue */

  /* UI Layout Spacing & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 22px;
}

.dark {
  /* Professional Enterprise Dark Neutral */
  --color-bg: #0B1329;
  --color-card: #1E293B;
  --color-bg-secondary: #141E33;
  --color-surface: #0B1329;
  --color-surface-container: #1E293B;

  --color-text-primary: #F8FAFC;
  --color-text-secondary: #94A3B8;
  --color-text-muted: #64748B;

  --color-border: #334155;
  --color-divider: #1E293B;

  --color-primary-light: rgba(30, 58, 138, 0.35);
  --color-secondary-light: rgba(15, 118, 110, 0.35);
}

/* Layout Stability & Stable Scrollbar Reservation (Prevents CLS & Page Jumping on Refresh) */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  max-width: 100%;
}

/* Global Font Smoothing & Base */
body {
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Preload Anti-Transition Shield: Completely blocks layout shifts, jumps, and transitions during initial render */
.preload,
.preload *,
.preload *::before,
.preload *::after {
  -webkit-transition: none !important;
  -moz-transition: none !important;
  -ms-transition: none !important;
  -o-transition: none !important;
  transition: none !important;
  animation-duration: 0s !important;
  animation-delay: 0s !important;
}

/* Material Symbols Icon Stabilization: Prevents raw ligature text (e.g. 'calendar_month') from causing width jumps */
.material-symbols-outlined {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  line-height: 1;
  overflow: hidden;
  vertical-align: middle;
  text-align: center;
  flex-shrink: 0;
  font-feature-settings: 'liga';
  -webkit-font-feature-settings: 'liga';
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}
.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Custom UI Component Classes */
.saas-card {
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 0.875rem;
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.dark .saas-card {
  background-color: #1E293B;
  border-color: #334155;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

.saas-card-interactive:hover {
  border-color: #CBD5E1;
  box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}
.dark .saas-card-interactive:hover {
  border-color: #475569;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.4);
}

/* Consistent Buttons */
.btn-primary {
  background-color: #1E3A8A;
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.5625rem 1rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px 0 rgba(30, 58, 138, 0.2);
}
.btn-primary:hover {
  background-color: #1D4ED8;
  box-shadow: 0 2px 4px 0 rgba(30, 58, 138, 0.3);
}
.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background-color: #FFFFFF;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.5625rem 1rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.03);
}
.btn-secondary:hover {
  background-color: #F8FAFC;
  border-color: #CBD5E1;
}
.dark .btn-secondary {
  background-color: #1E293B;
  color: #F8FAFC;
  border-color: #334155;
}
.dark .btn-secondary:hover {
  background-color: #334155;
}
.btn-secondary:active {
  transform: scale(0.98);
}

.btn-teal {
  background-color: #0F766E;
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.5625rem 1rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn-teal:hover {
  background-color: #0D9488;
}

.btn-success {
  background-color: #16A34A;
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.5625rem 1rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn-success:hover {
  background-color: #15803D;
}

.btn-danger {
  background-color: #DC2626;
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.5625rem 1rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn-danger:hover {
  background-color: #B91C1C;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 0.5rem;
  color: #64748B;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn-icon:hover {
  color: #0F172A;
  background-color: #F1F5F9;
}
.dark .btn-icon {
  color: #94A3B8;
}
.dark .btn-icon:hover {
  color: #FFFFFF;
  background-color: #334155;
}

/* Dynamic Custom Primary & Secondary Color Overrides */
.btn-primary,
button.bg-\[\#1E3A8A\],
.bg-\[\#1E3A8A\],
.bg-primary {
  background-color: var(--color-primary) !important;
}
button.bg-\[\#1E3A8A\]:hover,
.bg-\[\#1E3A8A\]:hover,
.hover\:bg-\[\#1D4ED8\]:hover {
  filter: brightness(1.1);
}
.text-\[\#1E3A8A\],
.text-primary {
  color: var(--color-primary) !important;
}
.border-\[\#1E3A8A\],
.border-primary {
  border-color: var(--color-primary) !important;
}

/* Secondary / Teal Utility Overrides */
.btn-secondary,
.btn-teal,
button.bg-\[\#0F766E\],
.bg-\[\#0F766E\],
.bg-secondary {
  background-color: var(--color-secondary) !important;
}
button.bg-\[\#0F766E\]:hover,
.bg-\[\#0F766E\]:hover,
.hover\:bg-\[\#0D9488\]:hover {
  filter: brightness(1.1);
}
.text-\[\#0F766E\],
.text-secondary,
.text-teal-600 {
  color: var(--color-secondary) !important;
}
.border-\[\#0F766E\],
.border-secondary {
  border-color: var(--color-secondary) !important;
}

/* ==========================================================================
   5 PRE-DESIGNED UI LAYOUT & STYLE FRAMEWORK TEMPLATES
   Controls the overall look, layout structure, card styling, corner radius,
   shadow elevation, and visual appearance of the entire application.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TEMPLATE: ENTERPRISE MODERN (Default Master SaaS)
   Balanced SaaS layout, 12px rounded cards, subtle shadows, clean borders.
   -------------------------------------------------------------------------- */
.template-enterprise-modern,
body.template-enterprise-modern {
  --app-card-radius: 0.75rem; /* 12px */
  --app-btn-radius: 0.5rem;   /* 8px */
}
.template-enterprise-modern .bg-white,
.template-enterprise-modern .saas-card {
  border-radius: 0.75rem !important;
  border: 1px solid #E2E8F0 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05) !important;
}
.dark .template-enterprise-modern .bg-slate-900,
.dark .template-enterprise-modern .bg-slate-800 {
  border-radius: 0.75rem !important;
  border: 1px solid #334155 !important;
}

/* --------------------------------------------------------------------------
   2. TEMPLATE: EXECUTIVE GLASSMORPHISM (Frosted Glass & Translucency)
   Translucent frosted cards, ambient background gradient, glossy borders.
   -------------------------------------------------------------------------- */
.template-executive-glass,
body.template-executive-glass {
  background: linear-gradient(135deg, #F1F5F9 0%, #E2E8F0 45%, #EEF2F6 100%) !important;
  min-height: 100vh;
}
.dark.template-executive-glass,
.dark .template-executive-glass,
body.dark.template-executive-glass {
  background: linear-gradient(135deg, #090E1E 0%, #0F172A 50%, #172554 100%) !important;
}
.template-executive-glass .bg-white,
.template-executive-glass .saas-card,
.template-executive-glass .bg-slate-50 {
  background-color: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(20px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(190%) !important;
  border: 1px solid rgba(255, 255, 255, 0.85) !important;
  box-shadow: 0 12px 36px 0 rgba(31, 38, 135, 0.09) !important;
  border-radius: 1.125rem !important;
}
.dark .template-executive-glass .bg-slate-900,
.dark .template-executive-glass .bg-slate-800,
.dark.template-executive-glass .bg-slate-900,
.dark.template-executive-glass .bg-slate-800 {
  background-color: rgba(30, 41, 59, 0.72) !important;
  backdrop-filter: blur(20px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(190%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 12px 36px 0 rgba(0, 0, 0, 0.45) !important;
  border-radius: 1.125rem !important;
}
.template-executive-glass #top-header {
  background-color: rgba(255, 255, 255, 0.75) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.6) !important;
}
.dark .template-executive-glass #top-header {
  background-color: rgba(15, 23, 42, 0.75) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.template-executive-glass #sidebar {
  background-color: rgba(15, 23, 42, 0.88) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
}
.template-executive-glass button {
  border-radius: 0.75rem !important;
}

/* --------------------------------------------------------------------------
   3. TEMPLATE: COMPACT LEDGER WORKSTATION (High-Density Financial View)
   Flat hairline grid borders, 3px square corners, compact data padding.
   -------------------------------------------------------------------------- */
.template-compact-ledger,
body.template-compact-ledger {
  font-size: 0.8125rem !important;
}
.template-compact-ledger .rounded-xl,
.template-compact-ledger .rounded-2xl,
.template-compact-ledger .rounded-3xl,
.template-compact-ledger .rounded-lg,
.template-compact-ledger .saas-card,
.template-compact-ledger .bg-white,
.template-compact-ledger input,
.template-compact-ledger select,
.template-compact-ledger textarea,
.template-compact-ledger button {
  border-radius: 3px !important;
}
.template-compact-ledger .bg-white,
.template-compact-ledger .saas-card {
  box-shadow: none !important;
  border: 1px solid #CBD5E1 !important;
}
.dark .template-compact-ledger .bg-slate-800,
.dark .template-compact-ledger .bg-slate-900,
.dark.template-compact-ledger .bg-slate-800,
.dark.template-compact-ledger .bg-slate-900 {
  box-shadow: none !important;
  border: 1px solid #475569 !important;
}
.template-compact-ledger table td,
.template-compact-ledger table th {
  padding-top: 0.35rem !important;
  padding-bottom: 0.35rem !important;
}

/* --------------------------------------------------------------------------
   4. TEMPLATE: SOFT NEOMORPHIC & FLOATING (Pillowy Warm Surfaces)
   26px extra-rounded cards, deep floating ambient drop shadows, pill buttons.
   -------------------------------------------------------------------------- */
.template-soft-neomorphic,
body.template-soft-neomorphic {
  background-color: #F8FAFC !important;
}
.template-soft-neomorphic .bg-white,
.template-soft-neomorphic .saas-card,
.template-soft-neomorphic .rounded-xl,
.template-soft-neomorphic .rounded-2xl {
  border-radius: 1.625rem !important; /* 26px */
  border: 1px solid rgba(226, 232, 240, 0.8) !important;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.09), 0 8px 16px -4px rgba(15, 23, 42, 0.04) !important;
}
.dark .template-soft-neomorphic .bg-slate-800,
.dark .template-soft-neomorphic .bg-slate-900,
.dark.template-soft-neomorphic .bg-slate-800,
.dark.template-soft-neomorphic .bg-slate-900 {
  border-radius: 1.625rem !important;
  border: 1px solid rgba(51, 65, 85, 0.6) !important;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5) !important;
}
.template-soft-neomorphic button,
.template-soft-neomorphic .rounded-full {
  border-radius: 9999px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07) !important;
}
.template-soft-neomorphic input,
.template-soft-neomorphic select {
  border-radius: 1rem !important;
}

/* --------------------------------------------------------------------------
   5. TEMPLATE: CLEAN MINIMALIST SWISS GRID (Flat Monochrome Structural)
   Zero drop shadows, bold 1.5px structural borders, sharp 0px geometry.
   -------------------------------------------------------------------------- */
.template-clean-minimalist,
body.template-clean-minimalist {
  background-color: #FFFFFF !important;
}
.dark.template-clean-minimalist,
.dark .template-clean-minimalist {
  background-color: #0B1329 !important;
}
.template-clean-minimalist .bg-white,
.template-clean-minimalist .saas-card,
.template-clean-minimalist .rounded-xl,
.template-clean-minimalist .rounded-2xl,
.template-clean-minimalist .rounded-3xl,
.template-clean-minimalist .rounded-lg,
.template-clean-minimalist button,
.template-clean-minimalist input,
.template-clean-minimalist select,
.template-clean-minimalist textarea {
  border-radius: 0px !important;
  box-shadow: none !important;
  border: 1.5px solid #0F172A !important;
}
.dark .template-clean-minimalist .bg-slate-800,
.dark .template-clean-minimalist .bg-slate-900,
.dark.template-clean-minimalist .bg-slate-800,
.dark.template-clean-minimalist .bg-slate-900 {
  border-radius: 0px !important;
  box-shadow: none !important;
  border: 1.5px solid #94A3B8 !important;
}

/* Status Badges */
.badge-royal {
  background-color: #DBEAFE;
  color: #1E3A8A;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.dark .badge-royal {
  background-color: rgba(30, 58, 138, 0.35);
  color: #93C5FD;
}

.badge-teal {
  background-color: #CCFBF1;
  color: #0F766E;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.dark .badge-teal {
  background-color: rgba(15, 118, 110, 0.35);
  color: #5EEAD4;
}

.badge-success {
  background-color: #DCFCE7;
  color: #15803D;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.dark .badge-success {
  background-color: rgba(22, 163, 74, 0.25);
  color: #86EFAC;
}

.badge-warning {
  background-color: #FEF3C7;
  color: #B45309;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.dark .badge-warning {
  background-color: rgba(217, 119, 6, 0.25);
  color: #FCD34D;
}

.badge-danger {
  background-color: #FEE2E2;
  color: #B91C1C;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.dark .badge-danger {
  background-color: rgba(220, 38, 38, 0.25);
  color: #FCA5A5;
}

.badge-info {
  background-color: #EFF6FF;
  color: #1D4ED8;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.dark .badge-info {
  background-color: rgba(37, 99, 235, 0.25);
  color: #93C5FD;
}

/* Forms & Inputs */
.saas-input {
  width: 100%;
  height: 2.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 0.5rem;
  color: #0F172A;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.saas-input:focus {
  outline: none;
  border-color: #1E3A8A;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}
.dark .saas-input {
  background-color: #0F172A;
  border-color: #334155;
  color: #F8FAFC;
}
.dark .saas-input:focus {
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Smooth transitions */
.transition-layout {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Glassmorphism effects */
.glass-panel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.dark .glass-panel {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Command Palette Overlay Animation */
@keyframes fade-in-scale {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.animate-scale-in {
  animation: fade-in-scale 0.16s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Mobile Simulator Skin */
.phone-mockup-frame {
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.3), 0 0 0 12px #0F172A, 0 0 0 14px #334155;
  border-radius: 44px;
}

/* Interactive Ripple on Click */
.btn-click-effect:active {
  transform: scale(0.98);
}

/* Thermal POS Slip Receipt */
.thermal-receipt-slip {
  font-family: 'Courier New', Courier, monospace;
  max-width: 360px;
  margin: 0 auto;
  background: #fff;
  color: #111;
  padding: 24px 18px;
  border: 1px dashed #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  position: relative;
}
.thermal-receipt-slip::before,
.thermal-receipt-slip::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background-size: 12px 6px;
}
.thermal-receipt-slip::before {
  top: -6px;
  background-image: radial-gradient(circle at 6px 6px, transparent 6px, #fff 6px);
}
.thermal-receipt-slip::after {
  bottom: -6px;
  background-image: radial-gradient(circle at 6px 0px, transparent 6px, #fff 6px);
}

/* Official Letterhead Receipt */
.official-letterhead-receipt {
  font-family: 'Inter', sans-serif;
  max-width: 720px;
  margin: 0 auto;
  background: #ffffff;
  color: #0f172a;
  border: 2px solid #1E3A8A;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 10px 25px -5px rgba(30, 58, 138, 0.1);
  position: relative;
  overflow: hidden;
}

/* Print Styles for Receipts, Reports & Name Tags */
@media print {
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  body * {
    visibility: hidden;
  }
  #printable-area, #printable-area * {
    visibility: visible !important;
  }
  #printable-area {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 10px;
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: none !important;
  }
  .official-letterhead-receipt {
    box-shadow: none !important;
    border: 2px solid #1E3A8A !important;
    max-width: 100% !important;
    padding: 20px !important;
  }
  .thermal-receipt-slip {
    box-shadow: none !important;
    border: 1px dashed #000 !important;
    max-width: 100% !important;
    margin: 0 auto !important;
  }
  .no-print {
    display: none !important;
  }
  @page {
    margin: 1cm;
    size: auto;
  }
}

/* Nametag sticker styling */
.nametag-sticker {
  width: 320px;
  border: 2px dashed #1E3A8A;
  border-radius: 12px;
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Sidebar Responsive & Desktop Toggle System */
#sidebar {
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.3s ease, visibility 0.3s;
}

#main-view-wrapper {
  transition: padding-left 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Desktop Sidebar System (screens >= 1024px only) */
@media (min-width: 1024px) {
  #sidebar {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 16rem !important; /* 256px */
    z-index: 40 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }

  html.sidebar-collapsed #sidebar,
  body.sidebar-collapsed #sidebar {
    transform: translateX(-100%) !important;
    visibility: hidden !important;
  }

  #main-view-wrapper {
    padding-left: 16rem !important;
  }

  html.sidebar-collapsed #main-view-wrapper,
  body.sidebar-collapsed #main-view-wrapper {
    padding-left: 0 !important;
  }
}

/* Login Screen Pre-Render Isolation: Prevents initial flash of dashboard shell */
html.is-login-screen #sidebar,
html.is-login-screen #top-header,
html.is-login-screen #mobile-bottom-nav {
  display: none !important;
}

html.is-login-screen #main-view-wrapper {
  padding-left: 0 !important;
}

html.is-login-screen #main-view-container {
  padding: 0 !important;
  max-width: none !important;
  width: 100% !important;
}

/* Mobile Drawer System (screens below lg: 1024px) */
@media (max-width: 1023.98px) {
  #sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 16rem !important; /* 256px */
    max-width: 85vw !important;
    z-index: 50 !important; /* Above backdrop (z-40), bottom nav (z-30), and header (z-20) */
    display: flex !important;
    transform: translateX(-100%) !important; /* Closed/off-screen by default on mobile */
    visibility: hidden;
    pointer-events: none;
    box-shadow: none !important;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.3s ease, box-shadow 0.3s ease !important;
  }

  html.sidebar-mobile-open #sidebar,
  body.sidebar-mobile-open #sidebar {
    transform: translateX(0) !important; /* Smoothly slides in when opened */
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
  }

  #sidebar-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 40 !important; /* Above bottom nav (z-30) and header (z-20), below sidebar (z-50) */
    background-color: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s cubic-bezier(0.32, 0.72, 0, 1) !important;
  }

  html.sidebar-mobile-open #sidebar-backdrop,
  body.sidebar-mobile-open #sidebar-backdrop {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Prevent background page scroll while mobile drawer is open */
  html.sidebar-mobile-open,
  body.sidebar-mobile-open {
    overflow: hidden !important;
  }
}

/* ==========================================================================
   ENTERPRISE RESPONSIVE SYSTEM & MOBILE-FIRST DEVICE ADAPTATION
   ========================================================================== */

/* Universal box-sizing and overflow safety */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* Mobile Touch Targets & Usability */
@media (max-width: 640px) {
  /* Prevent iOS Safari from auto-zooming when tapping inputs */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Safe tap target heights on mobile for primary interactive elements */
  .btn-primary,
  .btn-secondary,
  .btn-click-effect {
    min-height: 40px;
  }
}

/* Dynamic Viewport Units for Mobile Overlays & Drawers */
:root {
  --app-height: 100dvh;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* Universal Modal Overlay Responsiveness */
.modal-overlay {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain;
  padding: 0.75rem !important;
}

@media (min-width: 640px) {
  .modal-overlay {
    padding: 1.5rem !important;
  }
}

/* Ensure modal content dialog cards never exceed mobile viewport */
.modal-overlay > div {
  max-width: 100% !important;
  max-height: calc(100dvh - 1.5rem) !important;
  margin: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

@media (min-width: 640px) {
  .modal-overlay > div {
    max-height: calc(100dvh - 3rem) !important;
  }
}

/* Universal Table Responsive Wrappers */
.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  scrollbar-width: thin;
}

.table-responsive-wrapper table {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

/* Frozen / Sticky First Column for Wide Tables (e.g. RBAC Matrix) */
.table-sticky-first-col th:first-child,
.table-sticky-first-col td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background-color: inherit;
  box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.1);
}

.dark .table-sticky-first-col th:first-child,
.dark .table-sticky-first-col td:first-child {
  box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.5);
}

/* Horizontal Segmented Tabs Touch Optimization */
.horizontal-tabs-scroll {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
  padding-bottom: 6px;
}

.horizontal-tabs-scroll::-webkit-scrollbar {
  height: 6px;
}

.horizontal-tabs-scroll::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.8);
  border-radius: 9999px;
}

.dark .horizontal-tabs-scroll::-webkit-scrollbar-track {
  background: rgba(30, 41, 59, 0.8);
}

.horizontal-tabs-scroll::-webkit-scrollbar-thumb {
  background: #94A3B8;
  border-radius: 9999px;
}

.horizontal-tabs-scroll::-webkit-scrollbar-thumb:hover {
  background: #64748B;
}

/* Mobile Bottom Navigation Insets */
#mobile-bottom-nav {
  padding-bottom: calc(0.5rem + var(--safe-bottom));
}

/* Safe area padding for fixed main layout */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #main-view-container {
    padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }
  @media (min-width: 1024px) {
    #main-view-container {
      padding-bottom: 2rem;
    }
  }
}

/* Mobile Phone Mockup: on mobile devices (< 640px), expand full width without bezel */
@media (max-width: 640px) {
  .phone-mockup-frame {
    box-shadow: none !important;
    border-radius: 1.5rem !important;
    border: none !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 80vh !important;
  }
}

/* Ultra-wide Displays: Maintain maximum bounds and prevent over-stretching */
@media (min-width: 1921px) {
  #main-view-container {
    max-width: 1720px !important;
  }
}

/* ==========================================================================
   Auto-Sync Layout Stability & Zero-Shift Shield
   Prevents topbar jitter, element resizing, and layout shaking during sync
   ========================================================================== */
#topbar-sync-container {
  min-height: 34px;
  flex-shrink: 0;
}

#topbar-sync-btn {
  min-width: 96px;
  height: 34px;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
  contain: layout style;
}

#topbar-refresh-btn {
  min-width: 80px;
  height: 34px;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
  contain: layout style;
}

#sync-status-text {
  display: inline-block;
  min-width: 50px;
  text-align: left;
  white-space: nowrap;
}

#topbar-refresh-text {
  display: inline-block;
  min-width: 44px;
  text-align: left;
  white-space: nowrap;
}

#sync-status-dot {
  flex-shrink: 0;
  transform: translateZ(0);
}

#sync-pending-badge {
  flex-shrink: 0;
  min-width: 16px;
  text-align: center;
}

/* Silent Background Sync: Suppress re-animating cards, tables, and charts */
.silent-sync-active,
.silent-sync-active .animate-fade-in,
.silent-sync-active .animate-pulse {
  animation: none !important;
  transition: none !important;
}
