body {
  font-family: var(--font-sans);
  background-color: #f9fafb;
  color: #111827;
}

/* Printing styling Zone */
@media print {
  body > *:not(#print-capture-zone) {
    display: none !important;
  }
  #print-capture-zone, 
  #print-capture-zone * {
    visibility: visible;
  }
  #print-capture-zone {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #ffffff !important;
    color: #000000 !important;
  }
}

/* Compact View Layout Overrides */
.compact-view {
  font-size: 0.8125rem !important; /* Base ~13px */
}

/* Margins & Paddings */
.compact-view .p-8 {
  padding: 1rem !important;
}
.compact-view .p-6 {
  padding: 0.75rem !important;
}
.compact-view .p-5 {
  padding: 0.625rem !important;
}
.compact-view .p-4 {
  padding: 0.5rem !important;
}
.compact-view .p-3 {
  padding: 0.375rem !important;
}
.compact-view .pt-6 {
  padding-top: 0.75rem !important;
}
.compact-view .pb-6 {
  padding-bottom: 0.75rem !important;
}
.compact-view .px-6 {
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}
.compact-view .py-6 {
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
}
.compact-view .py-4 {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}
.compact-view .py-3 {
  padding-top: 0.375rem !important;
  padding-bottom: 0.375rem !important;
}
.compact-view .py-2 {
  padding-top: 0.25rem !important;
  padding-bottom: 0.25rem !important;
}
.compact-view .px-4 {
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}
.compact-view .px-3 {
  padding-left: 0.375rem !important;
  padding-right: 0.375rem !important;
}
.compact-view .my-6 {
  margin-top: 0.75rem !important;
  margin-bottom: 0.75rem !important;
}
.compact-view .my-4 {
  margin-top: 0.5rem !important;
  margin-bottom: 0.5rem !important;
}
.compact-view .mt-6 {
  margin-top: 0.75rem !important;
}
.compact-view .mt-4 {
  margin-top: 0.5rem !important;
}
.compact-view .mb-4 {
  margin-bottom: 0.5rem !important;
}
.compact-view .mb-6 {
  margin-bottom: 0.75rem !important;
}

/* Flexbox / Grid Gaps */
.compact-view .gap-8 {
  gap: 1rem !important;
}
.compact-view .gap-6 {
  gap: 0.75rem !important;
}
.compact-view .gap-4 {
  gap: 0.5rem !important;
}
.compact-view .gap-3 {
  gap: 0.375rem !important;
}
.compact-view .gap-2 {
  gap: 0.25rem !important;
}
.compact-view .gap-1.5 {
  gap: 0.1875rem !important;
}

/* Stack flow spacing */
.compact-view .space-y-8 > :not([hidden]) ~ :not([hidden]) {
  margin-top: 1rem !important;
}
.compact-view .space-y-6 > :not([hidden]) ~ :not([hidden]) {
  margin-top: 0.75rem !important;
}
.compact-view .space-y-4 > :not([hidden]) ~ :not([hidden]) {
  margin-top: 0.5rem !important;
}
.compact-view .space-y-3 > :not([hidden]) ~ :not([hidden]) {
  margin-top: 0.375rem !important;
}
.compact-view .space-y-2 > :not([hidden]) ~ :not([hidden]) {
  margin-top: 0.25rem !important;
}

/* Cards & Containers borders */
.compact-view .rounded-3xl {
  border-radius: 1rem !important; /* Map 3xl to lg/xl equivalent */
}
.compact-view .rounded-2xl {
  border-radius: 0.75rem !important; /* Map 2xl to lg/md equivalent */
}
.compact-view .rounded-xl {
  border-radius: 0.5rem !important; /* Map xl to md equivalent */
}
.compact-view .shadow-xl, 
.compact-view .shadow-2xl {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
}

/* Table Cells Padding and Sizing */
.compact-view table td {
  padding: 0.375rem 0.5rem !important; /* Tighter padding for cells */
  font-size: 0.75rem !important; /* 12px */
  line-height: 1rem !important;
}
.compact-view table th {
  padding: 0.375rem 0.5rem !important; /* Tighter padding for headers */
  font-size: 0.725rem !important; /* 11px */
  line-height: 1rem !important;
}

/* Form Fields */
.compact-view input, 
.compact-view select, 
.compact-view textarea {
  padding-top: 0.375rem !important;
  padding-bottom: 0.375rem !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
  font-size: 0.75rem !important; /* ~12px text */
  border-radius: 0.5rem !important;
  height: auto !important;
  min-height: 0px !important;
}
.compact-view label {
  font-size: 0.725rem !important;
  margin-bottom: 0.15rem !important;
}

/* Buttons and Spacing */
.compact-view button {
  padding-top: 0.375rem !important;
  padding-bottom: 0.375rem !important;
  padding-left: 0.625rem !important;
  padding-right: 0.625rem !important;
  font-size: 0.75rem !important; /* ~12px text */
  border-radius: 0.5rem !important;
}
.compact-view button.p-2 {
  padding: 0.25rem !important;
}
.compact-view button.p-3 {
  padding: 0.375rem !important;
}

/* Heading Sizes */
.compact-view .text-3xl {
  font-size: 1.375rem !important; /* 22px */
}
.compact-view .text-2xl {
  font-size: 1.2rem !important; /* 19.2px */
}
.compact-view .text-xl {
  font-size: 1rem !important; /* 16px */
}
.compact-view .text-lg {
  font-size: 0.875rem !important; /* 14px */
}
.compact-view .text-base {
  font-size: 0.8125rem !important; /* 13px */
}
.compact-view .text-sm {
  font-size: 0.75rem !important; /* 12px */
}
.compact-view .text-xs {
  font-size: 0.6875rem !important; /* 11px */
}

/* Automatic Mobile Sizing Scale & Spacing Optimization - Balanced & Spacious for Clear Details */
@media (max-width: 768px) {
  html {
    font-size: 14px !important; /* Extremely readable default base font size */
  }

  /* Provide comfortable breathing room rather than cramping content */
  main .p-6,
  main .p-8 {
    padding: 1.25rem !important; /* Generous but mobile-safe outer padding */
  }
  main .p-4 {
    padding: 0.875rem !important;
  }
  main .p-5 {
    padding: 1rem !important;
  }

  /* Spacious, elegant margins & gaps for a clean rhythm */
  main .my-6, main .my-4 {
    margin-top: 0.75rem !important;
    margin-bottom: 0.75rem !important;
  }
  main .mt-6 { margin-top: 1.25rem !important; }
  main .mt-4 { margin-top: 1rem !important; }
  main .mb-6 { margin-bottom: 1.25rem !important; }
  main .mb-4 { margin-bottom: 1rem !important; }

  main .gap-8 { gap: 1.25rem !important; }
  main .gap-6 { gap: 1rem !important; }
  main .gap-4 { gap: 0.75rem !important; }
  main .gap-3 { gap: 0.625rem !important; }
  main .gap-2 { gap: 0.5rem !important; }

  main .space-y-8 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.25rem !important; }
  main .space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem !important; }
  main .space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem !important; }
  main .space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.625rem !important; }
  main .space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem !important; }

  /* Keep borders and cards elegant and rounded */
  main .rounded-3xl { border-radius: 1.25rem !important; }
  main .rounded-2xl { border-radius: 1rem !important; }
  main .rounded-xl { border-radius: 0.75rem !important; }

  /* Beautifully spaced, readable high-density tables */
  main table td {
    padding: 0.625rem 0.75rem !important; /* Elegant table cell padding for clear data presentation */
    font-size: 0.825rem !important; /* Clear, highly readable font size */
    line-height: 1.1rem !important;
  }
  main table th {
    padding: 0.625rem 0.75rem !important;
    font-size: 0.8rem !important;
    line-height: 1.1rem !important;
  }

  /* Spacious, modern form inputs */
  main input,
  main select,
  main textarea {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    font-size: 0.85rem !important;
    border-radius: 0.5rem !important;
    height: auto !important;
    min-height: 38px !important; /* Beautifully touch-friendly height */
  }
  main label {
    font-size: 0.8rem !important;
    margin-bottom: 0.25rem !important;
    font-weight: 500 !important;
  }

  /* Easy-to-tap, comfortable mobile buttons */
  main button:not(.hidden) {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    font-size: 0.825rem !important;
    border-radius: 0.5rem !important;
    min-height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  main button.hidden {
    display: none !important;
  }
  main button.p-2 { padding: 0.375rem !important; }
  main button.p-3 { padding: 0.5rem !important; }

  /* Elegant font-size transitions for titles & headings */
  main .text-3xl { font-size: 1.625rem !important; }
  main .text-2xl { font-size: 1.375rem !important; }
  main .text-xl { font-size: 1.125rem !important; }
  main .text-lg { font-size: 0.95rem !important; }
  main .text-base { font-size: 0.85rem !important; }
  main .text-sm { font-size: 0.775rem !important; }
  main .text-xs { font-size: 0.7rem !important; }
}

/* Responsive frozen/sticky columns for reports table */
@media (min-width: 1024px) {
  .sticky-col-action {
    position: sticky !important;
    right: 100px !important;
    width: 140px !important;
    min-width: 140px !important;
    z-index: 10 !important;
  }
  .sticky-col-edit-delete {
    position: sticky !important;
    right: 0px !important;
    width: 100px !important;
    min-width: 100px !important;
    z-index: 10 !important;
  }
  /* Header cells require a higher z-index to sit above scrollable body cells */
  th.sticky-col-action {
    z-index: 20 !important;
  }
  th.sticky-col-edit-delete {
    z-index: 20 !important;
  }
}
@media (max-width: 1023px) {
  .sticky-col-action,
  .sticky-col-edit-delete {
    position: static !important;
    right: auto !important;
    width: auto !important;
    min-width: unset !important;
    z-index: auto !important;
  }
}

/* Custom scrollbar styling for sidebar container */
.sidebar-scroll::-webkit-scrollbar {
  width: 5px;
}
.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(236, 72, 153, 0.2); /* elegant pink-500 thumb with 20% opacity */
  border-radius: 9999px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(236, 72, 153, 0.45); /* elegant pink-500 thumb with 45% opacity on hover */
}

/* Global table styling to prevent header name wrap text and ensure clear details across all pages */
main table th, 
table th {
  white-space: nowrap !important;
  word-break: keep-all !important;
}

/* Ensure table data cells show clearly without cramped text wrapping */
main table td,
table td {
  white-space: nowrap !important;
}

/* Let all tables automatically expand and fit content perfectly on wider screens */
main table {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: auto !important; /* Allow columns to auto-expand to fit names perfectly */
}

/* Elegant scrollbar styling for wide tables with overflow */
main div.overflow-x-auto {
  scrollbar-width: thin;
  scrollbar-color: rgba(236, 72, 153, 0.25) transparent;
}

main div.overflow-x-auto::-webkit-scrollbar {
  height: 6px;
}

main div.overflow-x-auto::-webkit-scrollbar-track {
  background: transparent;
}

main div.overflow-x-auto::-webkit-scrollbar-thumb {
  background: rgba(236, 72, 153, 0.25);
  border-radius: 9999px;
}

main div.overflow-x-auto::-webkit-scrollbar-thumb:hover {
  background: rgba(236, 72, 153, 0.5);
}