/**
 * ==========================================================================
 * RSA Table Component (rsa-table.css)
 * Standardized Data Table & Responsive Shell System for e-RSA
 * 
 * Features: Responsive Container Shell, Sticky Headers, Card Integration,
 *           Row States, Vertical Alignment, and Mobile Touch Scroll
 * Breakpoints: Strictly locked to Mobile (< 768px) & Desktop (>= 768px)
 * ==========================================================================
 */

/* 1. Responsive Shell Container */
.table-responsive {
  width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scroll-behavior: smooth;
  position: relative;
}

/* Seamless Card Integration: Eliminate Double Borders */
.card>.table-responsive,
.card-body>.table-responsive,
.card-datatable {
  margin-bottom: 0;
  border: none !important;
}

.card>.table-responsive:first-child {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.card>.table-responsive:last-child {
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}

/* Page Table Card Shell: Clean Subtle Border & Elevation (Identical to Standalone Cards) */
.card:has(> .table-responsive),
.card:has(> form > .table-responsive),
.card:has(> .card-body > .table-responsive),
.card:has(> .table),
.card-datatable {
  border: 1px solid var(--border-light-mode, rgba(0, 0, 0, 0.08)) !important;
  border-radius: var(--bs-card-border-radius, 1.25rem) !important;
  overflow: hidden !important;
  box-shadow: none !important;
}

[data-bs-theme="dark"] .card:has(> .table-responsive),
[data-bs-theme="dark"] .card:has(> form > .table-responsive),
[data-bs-theme="dark"] .card:has(> .card-body > .table-responsive),
[data-bs-theme="dark"] .card:has(> .table),
[data-bs-theme="dark"] .card-datatable {
  border: none !important;
  border-width: 0 !important;
  border-radius: var(--bs-card-border-radius, 1.25rem) !important;
  overflow: hidden !important;
  box-shadow: none !important;
}

/* Allow table card shell to overflow visibly so floating popups (dropdowns, selects, flatpickr) are never clipped */
.card:has(.dropdown-menu.show),
.card:has(.ts-wrapper.dropdown-active),
.card:has(.ts-dropdown.show),
.card.dropdown-opened-card,
[data-bs-theme="dark"] .card:has(.dropdown-menu.show),
[data-bs-theme="dark"] .card:has(.ts-wrapper.dropdown-active),
[data-bs-theme="dark"] .card:has(.ts-dropdown.show),
[data-bs-theme="dark"] .card.dropdown-opened-card {
  overflow: visible !important;
}

/* Ensure all floating panels in tables sit at maximum elevation */
.table-responsive .dropdown-menu,
.table .dropdown-menu,
.card .dropdown-menu {
  z-index: 100000 !important;
}

/* 2. Global Table Typography & Structure */
.table {
  width: 100%;
  margin-bottom: 0;
  vertical-align: middle;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom-width: 1px;
}

/* 3. Standard Table Header (thead) */
.table thead th {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--bs-secondary, #707070);
  background-color: var(--bs-table-bg, rgba(0, 0, 0, 0.02));
  border-bottom: 1px solid var(--bs-border-color, #e5e5e5);
  white-space: nowrap;
}

[data-bs-theme="dark"] .table thead th {
  background-color: var(--bs-modal-table-bg, var(--bs-surface-elevated));
  border-bottom: none !important;
  border-bottom-color: transparent !important;
  color: #a0a0a0;
}

/* Card Header Flat Edge: Tables inside cards with header must have 0 top border-radius */
.card-header~.table-responsive,
.card-header~table,
.card-header~* .table-responsive,
.card:has(.card-header)>.table-responsive,
.card:has(.card-header) table {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}


/* Sticky Header Support */
.table-sticky-header thead th,
.table thead.sticky-top th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--bs-border-color, #e5e5e5);
}

[data-bs-theme="dark"] .table-sticky-header thead th,
[data-bs-theme="dark"] .table thead.sticky-top th {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* 4. Table Row States (Hover & Selection) - Instant crisp selection feedback with zero lag or lingering transitions */
.table-hover>tbody>tr,
.table-hover>tbody>tr>*,
.table:not(.table-no-hover)>tbody>tr,
.table:not(.table-no-hover)>tbody>tr>*,
.table tbody>tr,
.table tbody>tr>* {
  transition: none !important;
}

.table-hover>tbody>tr:hover,
.table:not(.table-no-hover)>tbody>tr:hover {
  background-color: transparent !important;
}

/* Desktop-only subtle hover background feedback */
@media (hover: hover) and (pointer: fine) {

  .table-hover>tbody>tr:not(.selected):not(.user-row-selected):not(.table-active):hover>*,
  .table:not(.table-no-hover)>tbody>tr:not(.selected):not(.user-row-selected):not(.table-active):hover>* {
    --bs-table-hover-bg: var(--table-row-hover-bg, rgba(0, 0, 0, 0.025)) !important;
    --bs-table-bg-state: var(--table-row-hover-bg, rgba(0, 0, 0, 0.025)) !important;
    background-color: var(--table-row-hover-bg, rgba(0, 0, 0, 0.025)) !important;
    box-shadow: none !important;
  }

  [data-bs-theme="dark"] .table-hover>tbody>tr:not(.selected):not(.user-row-selected):not(.table-active):hover>*,
  [data-bs-theme="dark"] .table:not(.table-no-hover)>tbody>tr:not(.selected):not(.user-row-selected):not(.table-active):hover>*,
  [data-bs-theme="dark"] .user-row-clickable:not(.selected):not(.user-row-selected):not(.table-active):hover>*,
  [data-bs-theme="dark"] .user-row-clickable:not(.selected):not(.user-row-selected):not(.table-active):hover>td {
    --bs-table-hover-bg: transparent !important;
    --bs-table-bg-state: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
  }
}

/* Mobile & touch devices: strictly NO sticky row hover background */
@media (max-width: 767.98px),
(hover: none) {

  .table-hover>tbody>tr:not(.selected):not(.user-row-selected):not(.table-active):hover>*,
  .table:not(.table-no-hover)>tbody>tr:not(.selected):not(.user-row-selected):not(.table-active):hover>*,
  .user-row-clickable:not(.selected):not(.user-row-selected):not(.table-active):hover>*,
  .user-row-clickable:not(.selected):not(.user-row-selected):not(.table-active):hover>td,
  [data-bs-theme="dark"] .table-hover>tbody>tr:not(.selected):not(.user-row-selected):not(.table-active):hover>*,
  [data-bs-theme="dark"] .table:not(.table-no-hover)>tbody>tr:not(.selected):not(.user-row-selected):not(.table-active):hover>*,
  [data-bs-theme="dark"] .user-row-clickable:not(.selected):not(.user-row-selected):not(.table-active):hover>*,
  [data-bs-theme="dark"] .user-row-clickable:not(.selected):not(.user-row-selected):not(.table-active):hover>td {
    --bs-table-hover-bg: transparent !important;
    --bs-table-bg-state: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
  }
}

/* Selected Row State (Multi-select selection) */
.table tbody>tr.selected,
.table tbody>tr.table-active {
  background-color: var(--bs-table-selected-bg) !important;
}

[data-bs-theme="dark"] .table tbody>tr.selected,
[data-bs-theme="dark"] .table tbody>tr.table-active {
  background-color: var(--bs-table-selected-bg) !important;
}

/* 5. Special Columns */
/* Standard Checkbox Selection Column (Desktop) */
.table th.col-checkbox-cell,
.table td.col-checkbox-cell {
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  text-align: center !important;
}

/* Tables where avatar acts as the selection button (Users, Team & Attendance) */
#usersResultsSection th.col-checkbox-cell,
#usersResultsSection td.col-checkbox-cell,
#teamResultsSection th.col-checkbox-cell,
#teamResultsSection td.col-checkbox-cell,
#attendanceTable th.col-checkbox-cell,
#attendanceTable td.col-checkbox-cell,
#participantsTable th.col-checkbox-cell,
#participantsTable td.col-checkbox-cell {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  visibility: hidden !important;
}


/* Action button column */
.table th.th-action,
.table td.td-action {
  width: 64px;
  min-width: 64px;
  text-align: center;
  padding-left: 0.5rem;
  padding-right: 0.75rem;
}

/* Table Dropdown Menus: Always float above tables, headers, and borders without clipping */
.table-responsive .dropdown-menu,
table .dropdown-menu {
  z-index: 1060 !important;
}

/* Table Header Sort Icons: Standard compact size, never enlarged, consistent color & opacity */
.table thead th .material-symbols-outlined,
.table thead th .sort-icon-indicator,
.table thead th .sort-icon,
.table thead th span[class*="sort"],
th .sort-icon-indicator,
th .sort-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.1em !important;
  width: 1.1em !important;
  min-width: 1.1em !important;
  max-width: 1.1em !important;
  height: 1.1em !important;
  min-height: 1.1em !important;
  max-height: 1.1em !important;
  line-height: 1 !important;
  vertical-align: middle !important;
  margin-left: 0.25rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  user-select: none !important;
  transform: translateY(-0.75px) !important;
  transition: none !important;
}

/* Inactive sort icons: Uniform secondary/muted color and subtle opacity across all tables */
.table thead th .sort-icon:not(.text-primary):not(.text-danger):not(.text-success),
.table thead th .sort-icon-indicator:not(.text-primary),
.table thead th .material-symbols-outlined.text-muted:not(.text-primary):not(.text-danger):not(.text-success),
.table thead th.cursor-pointer .material-symbols-outlined:not(.text-primary):not(.text-danger):not(.text-success),
th[class*="sortable"] .material-symbols-outlined:not(.text-primary):not(.text-danger):not(.text-success),
th[data-sort-field] .material-symbols-outlined:not(.text-primary):not(.text-danger):not(.text-success),
th .sort-icon:not(.text-primary):not(.text-danger):not(.text-success),
th .sort-icon-indicator:not(.text-primary) {
  color: var(--bs-secondary-color, #8b8b8b) !important;
  opacity: 0.65 !important;
}

/* Hover state on sortable table headers */
.table thead th.cursor-pointer:hover .material-symbols-outlined:not(.text-primary),
th[class*="sortable"]:hover .material-symbols-outlined:not(.text-primary),
th[data-sort-field]:hover .material-symbols-outlined:not(.text-primary),
th:hover .sort-icon:not(.text-primary),
th:hover .sort-icon-indicator:not(.text-primary) {
  opacity: 1 !important;
  color: var(--bs-body-color, #e4e6ef) !important;
  transition: opacity 0.15s ease, color 0.15s ease !important;
}

/* Active sorted header icon state */
.table thead th .sort-icon.text-primary,
.table thead th .material-symbols-outlined.text-primary,
.table thead th.asc .material-symbols-outlined,
.table thead th.desc .material-symbols-outlined,
.table thead th.asc .sort-icon,
.table thead th.desc .sort-icon {
  color: var(--bs-primary, #ff5911) !important;
  opacity: 1 !important;
}

/* 6. Mobile Responsiveness (< 768px) */
@media (max-width: 767.98px) {

  .table th,
  .table td {
    padding: 0.75rem 0.85rem;
    font-size: 0.875rem;
  }

  .table thead th {
    font-size: 0.7rem;
  }
}

/* 7. Tables Inside Modals & Dialogs (Frameless Inset Container matching modal card) */
.modal .unfilled-sessions-main-container,
.modal .card:has(table) {
  border: none !important;
  border-width: 0 !important;
  background-color: var(--bs-modal-card-bg, #ffffff) !important;
  border-radius: var(--bs-card-border-radius, 1rem) !important;
  overflow: hidden !important;
  box-shadow: none !important;
}

.modal .modal-table-container {
  background-color: var(--bs-modal-card-bg, #ffffff) !important;
  border-radius: var(--bs-card-border-radius, 0.75rem) !important;
  max-height: clamp(280px, 55vh, 460px);
  overflow-y: auto !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  box-shadow: none !important;
}

[data-bs-theme="dark"] .modal .unfilled-sessions-main-container,
[data-bs-theme="dark"] .modal .card:has(table) {
  border: none !important;
  border-width: 0 !important;
  background-color: transparent !important;
}

[data-bs-theme="dark"] .modal .modal-table-container {
  background-color: transparent !important;
}

.modal .modal-table-container thead th {
  background-color: var(--bs-modal-card-bg, #ffffff) !important;
}

[data-bs-theme="dark"] .modal .modal-table-container thead th,
.dark-style .modal .modal-table-container thead th {
  background-color: var(--bs-modal-bg, var(--bs-card-bg, #1e1e1e)) !important;
}

.modal .card-body {
  border-top-left-radius: inherit !important;
  border-top-right-radius: inherit !important;
  overflow: hidden;
}

.modal .table-responsive {
  border-top-left-radius: inherit !important;
  border-top-right-radius: inherit !important;
}

.modal .table thead tr:first-child th:first-child {
  border-top-left-radius: inherit !important;
}

.modal .table thead tr:first-child th:last-child {
  border-top-right-radius: inherit !important;
}

/* All Modal Tables: Completely hide thead (column headers) for clean sheet list UX */
.modal table thead,
.modal .table thead,
.modal-table-container thead,
.bottom-sheet-modal table thead,
.bottom-sheet-modal .table thead,
.modal table>thead,
.modal .modal-table-container>table>thead,
.modal-table-container>.table>thead,
.modal table thead[class*="d-"],
.modal .table thead[class*="d-"] {
  display: none !important;
}

/* Dark Mode: Global subtle border box and rounded container for ALL modal tables across all pages */
[data-bs-theme="dark"] .modal .modal-table-container,
[data-bs-theme="dark"] .modal .table-responsive:not(.card .table-responsive):not(.card-body .table-responsive),
[data-bs-theme="dark"] .modal [class*="modal-table"],
[data-bs-theme="dark"] .modal-table-container,
[data-bs-theme="dark"] .bottom-sheet-modal .modal-table-container,
[data-bs-theme="dark"] .bottom-sheet-modal .table-responsive,
.dark-style .modal .modal-table-container,
.dark-style .modal .table-responsive:not(.card .table-responsive):not(.card-body .table-responsive),
.dark-style .modal-table-container {
  border: 1px solid var(--bs-modal-table-border, rgba(255, 255, 255, 0.12)) !important;
  border-radius: var(--bs-modal-table-border-radius, var(--bs-border-radius-lg, 0.75rem)) !important;
  background-color: var(--bs-modal-table-bg, transparent) !important;
  max-height: clamp(280px, 55vh, 460px);
  overflow-y: auto !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

[data-bs-theme="dark"] .modal .table,
[data-bs-theme="dark"] .modal table,
[data-bs-theme="dark"] .bottom-sheet-modal .table,
[data-bs-theme="dark"] .bottom-sheet-modal table {
  border: none !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  background-color: transparent !important;
  --bs-table-bg: transparent !important;
}

/* Dark Mode: Modal Table Horizontal Row Dividers (Subtle, matching page table divider) */
[data-bs-theme="dark"] .modal .table thead th,
[data-bs-theme="dark"] .modal table thead th {
  border: none !important;
  border-bottom: none !important;
  background-color: var(--bs-modal-bg, var(--bs-card-bg, #1e1e1e)) !important;
  --bs-table-bg: var(--bs-modal-bg, var(--bs-card-bg, #1e1e1e)) !important;
}

[data-bs-theme="dark"] .modal .table tbody tr:not(:last-child):not(:last-of-type) td,
[data-bs-theme="dark"] .modal .table tbody tr:not(:last-child):not(:last-of-type) th,
[data-bs-theme="dark"] .modal table tbody tr:not(:last-child):not(:last-of-type) td,
[data-bs-theme="dark"] .modal table tbody tr:not(:last-child):not(:last-of-type) th,
[data-bs-theme="dark"] .bottom-sheet-modal .table tbody tr:not(:last-child):not(:last-of-type) td,
[data-bs-theme="dark"] .bottom-sheet-modal .table tbody tr:not(:last-child):not(:last-of-type) th {
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: 1px solid var(--bs-modal-table-border, rgba(255, 255, 255, 0.12)) !important;
  box-shadow: none !important;
  background-color: transparent !important;
  --bs-table-bg: transparent !important;
}

/* Soft Row Hover on Modal Tables in Dark Mode (Using root.css variable) */
[data-bs-theme="dark"] .modal .table-hover tbody tr:not(.selected):not(.user-row-selected):not(.table-active):hover>td,
[data-bs-theme="dark"] .modal .table-hover tbody tr:not(.selected):not(.user-row-selected):not(.table-active):hover>th,
[data-bs-theme="dark"] .modal table.table-hover tbody tr:not(.selected):not(.user-row-selected):not(.table-active):hover>td,
[data-bs-theme="dark"] .modal table.table-hover tbody tr:not(.selected):not(.user-row-selected):not(.table-active):hover>th {
  background-color: var(--bs-modal-table-hover-bg, rgba(255, 255, 255, 0.04)) !important;
  --bs-table-hover-bg: var(--bs-modal-table-hover-bg, rgba(255, 255, 255, 0.04)) !important;
}

/* Remove bottom border on the very last row in all tables for clean seamless finish */
:is([data-bs-theme="dark"], .dark-style, html, body) :is(.modal, .bottom-sheet-modal, .offcanvas, body) :is(table, .table) tbody tr:is(:last-child, :last-of-type) :is(td, th, > *),
[data-bs-theme="dark"] .modal table.table tbody tr:is(:last-child, :last-of-type) :is(td, th, > *),
[data-bs-theme="dark"] .modal .modal-table-container table tbody tr:is(:last-child, :last-of-type) :is(td, th, > *),
[data-bs-theme="dark"] .modal table.table tr:is(:last-child, :last-of-type) :is(td, th, > *),
[data-bs-theme="dark"] .modal table.table tr:is(:last-child, :last-of-type).selected :is(td, th, > *),
[data-bs-theme="dark"] .modal table.table tr:is(:last-child, :last-of-type).user-row-selected :is(td, th, > *),
[data-bs-theme="dark"] .modal table.table tr:is(:last-child, :last-of-type):hover :is(td, th, > *),
[data-bs-theme="dark"] .modal table.table tr:is(:last-child, :last-of-type):not(.selected):not(.user-row-selected):not(.table-active) :is(td, th, > *),
table tbody tr:last-child td,
table tbody tr:last-child th,
table tbody tr:last-child>*,
table tbody tr:last-of-type>*,
.table tbody tr:last-child td,
.table tbody tr:last-child th,
.table tbody tr:last-child>*,
.table tbody tr:last-of-type>*,
.table>tbody>tr:last-child>*,
.table>tbody>tr:last-of-type>*,
.modal .table tbody tr:last-child td,
.modal .table tbody tr:last-child th,
.modal .table tbody tr:last-child>*,
.modal table tbody tr:last-child td,
.modal table tbody tr:last-child th,
.modal table tbody tr:last-child>*,
.modal .modal-table-container .table tbody tr:last-child>*,
.modal-table-container .table tbody tr:last-child>*,
.bottom-sheet-modal .table tbody tr:last-child td,
.bottom-sheet-modal .table tbody tr:last-child th,
[data-bs-theme="dark"] table tbody tr:last-child td,
[data-bs-theme="dark"] table tbody tr:last-child th,
[data-bs-theme="dark"] table tbody tr:last-child>*,
[data-bs-theme="dark"] table tbody tr:last-of-type>*,
[data-bs-theme="dark"] .table tbody tr:last-child td,
[data-bs-theme="dark"] .table tbody tr:last-child th,
[data-bs-theme="dark"] .table tbody tr:last-child>*,
[data-bs-theme="dark"] .table tbody tr:last-of-type>*,
[data-bs-theme="dark"] .table>tbody>tr:last-child>*,
[data-bs-theme="dark"] .table>tbody>tr:last-of-type>*,
[data-bs-theme="dark"] .modal .table tbody tr:last-child td,
[data-bs-theme="dark"] .modal .table tbody tr:last-child th,
[data-bs-theme="dark"] .modal .table tbody tr:last-child>*,
[data-bs-theme="dark"] .modal table tbody tr:last-child td,
[data-bs-theme="dark"] .modal table tbody tr:last-child th,
[data-bs-theme="dark"] .modal table tbody tr:last-child>*,
[data-bs-theme="dark"] .modal .modal-table-container .table tbody tr:last-child>*,
[data-bs-theme="dark"] .modal-table-container .table tbody tr:last-child>*,
[data-bs-theme="dark"] .bottom-sheet-modal .table tbody tr:last-child td,
[data-bs-theme="dark"] .bottom-sheet-modal .table tbody tr:last-child th {
  border-bottom: none !important;
  border-bottom-width: 0 !important;
  border-bottom-color: transparent !important;
  border-bottom-style: none !important;
}

/* Ensure generous bottom padding for the last row in modal tables to avoid squished appearance against rounded bottom border */
.modal table tbody tr:last-child>td,
.modal table tbody tr:last-child>th,
.modal .modal-table-container table tbody tr:last-child>td,
.modal .modal-table-container table tbody tr:last-child>th,
.modal .table-responsive table tbody tr:last-child>td,
.modal .table-responsive table tbody tr:last-child>th,
.bottom-sheet-modal table tbody tr:last-child>td,
.bottom-sheet-modal table tbody tr:last-child>th,
[data-bs-theme="dark"] .modal table tbody tr:last-child>td,
[data-bs-theme="dark"] .modal table tbody tr:last-child>th,
[data-bs-theme="dark"] .modal .modal-table-container table tbody tr:last-child>td,
[data-bs-theme="dark"] .modal .modal-table-container table tbody tr:last-child>th,
[data-bs-theme="dark"] .modal .table-responsive table tbody tr:last-child>td,
[data-bs-theme="dark"] .modal .table-responsive table tbody tr:last-child>th,
[data-bs-theme="dark"] .bottom-sheet-modal table tbody tr:last-child>td,
[data-bs-theme="dark"] .bottom-sheet-modal table tbody tr:last-child>th {
  padding-bottom: var(--bs-modal-table-last-row-padding-bottom, 0.95rem) !important;
}


/* Modal Tables: Hide top border on pagination footers to prevent floating lines */
.modal [id*="PaginationFooter"],
.modal [id*="paginationFooter"],
.modal [id*="Pagination"],
.modal #modalAddTeamPagination,
.modal .modal-pagination-footer {
  border-top: none !important;
  border-top-width: 0 !important;
  border-top-color: transparent !important;
}


/* Modal Tables: Strictly prevent any secondary left indicator bar after checkbox when selected */
.modal table tbody tr.selected>td:not(:first-child),
.modal table tbody tr.selected:hover>td:not(:first-child),
.modal table tbody tr.user-row-selected>td:not(:first-child),
.modal table tbody tr.user-row-selected:hover>td:not(:first-child),
.modal-table-container table tbody tr.selected>td:not(:first-child),
.modal-table-container table tbody tr.selected:hover>td:not(:first-child),
.modal-table-container table tbody tr.user-row-selected>td:not(:first-child),
.modal-table-container table tbody tr.user-row-selected:hover>td:not(:first-child),
.modal table tbody tr.selected>td.col-checkbox-cell+td,
.modal table tbody tr.user-row-selected>td.col-checkbox-cell+td,
.modal table tbody tr.selected>td.col-checkbox-cell~td,
.modal table tbody tr.user-row-selected>td.col-checkbox-cell~td {
  box-shadow: none !important;
  border-left: none !important;
  border-left-width: 0 !important;
}

/* Modal Footer Dropup Positioning: Strictly anchored directly above the trigger button */
.modal-footer .dropup,
.modal-footer .dropdown {
  position: relative !important;
}

.modal-footer .dropup .dropdown-menu,
.modal-footer .dropup .dropdown-menu[data-bs-popper="static"],
.modal-footer .dropup .dropdown-menu-end,
.modal-footer .dropdown-menu-end {
  right: 0 !important;
  left: auto !important;
  bottom: 100% !important;
  top: auto !important;
  margin-top: 0 !important;
  margin-bottom: 0.5rem !important;
  transform: none !important;
  z-index: 1060 !important;
}

[data-bs-theme="dark"] .modal-footer .dropup .dropdown-menu,
[data-bs-theme="dark"] .modal-footer .dropdown .dropdown-menu {
  background-color: var(--bs-modal-card-bg, var(--bs-surface-elevated)) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5) !important;
}

/* ==========================================================================
   Interactive / Selectable Table Rows: Pointer Cursor System
   - Modals Default: cursor: default on rows, cells, text, badges
   - Modals Selectable: 1-Click row select (cursor: pointer strictly on selectable tables/rows)
   - Page Tables (Desktop >= 768px): cursor: default on rows, cells, text, badges
     (Selection strictly via Checkbox or Avatar; Action buttons retain pointer)
   ========================================================================== */

/* 1. Modal Default Rows: Non-selectable table rows have default cursor */
.modal table tbody tr,
.modal table tbody tr>td,
.modal table tbody tr>th,
.modal .modal-table-container tbody tr,
.modal .modal-table-container tbody tr>td,
.modal .modal-table-container tbody tr>th {
  cursor: default !important;
}

/* 2. Genuine 1-Click Selectable Rows (Strictly inside Modals) */
.modal table tbody tr.cursor-pointer,
.modal table tbody tr.cursor-pointer>*,
.modal table tbody tr.selectable-row,
.modal table tbody tr.selectable-row>*,
.modal table tbody tr.clickable-row,
.modal table tbody tr.clickable-row>*,
.modal table tbody tr.recovery-user-row,
.modal table tbody tr.recovery-user-row>*,
.modal table tbody tr.export-participant-row,
.modal table tbody tr.export-participant-row>*,
.modal table tbody tr.export-class-row,
.modal table tbody tr.export-class-row>*,
.modal table tbody tr.export-material-row,
.modal table tbody tr.export-material-row>*,
.modal #availableParticipantsTable tbody tr,
.modal #availableParticipantsTable tbody tr>*,
.modal #recoveryUsersTableBody tr,
.modal #recoveryUsersTableBody tr>*,
.modal #recoverySessionsTableBody tr,
.modal #recoverySessionsTableBody tr>*,
.modal #recoveryClassesTableBody tr,
.modal #recoveryClassesTableBody tr>*,
.modal #recoveryClassSessionsTableBody tr,
.modal #recoveryClassSessionsTableBody tr>*,
.modal #recoveryMaterialsTableBody tr,
.modal #recoveryMaterialsTableBody tr>*,
.modal table[data-selectable="true"] tbody tr,
.modal table[data-selectable="true"] tbody tr>* {
  cursor: pointer !important;
}

/* Retain text cursor for text inputs inside modal rows */
.modal table tbody tr input[type="text"],
.modal table tbody tr input[type="search"],
.modal table tbody tr input[type="password"] {
  cursor: text !important;
}

/* Retain pointer cursor for interactive controls inside ANY modal table row */
.modal table tbody tr button,
.modal table tbody tr button *,
.modal table tbody tr .btn,
.modal table tbody tr .btn *,
.modal table tbody tr a,
.modal table tbody tr a *,
.modal table tbody tr input[type="checkbox"],
.modal table tbody tr input[type="radio"],
.modal table tbody tr .form-check-input,
.modal table tbody tr .dropdown-toggle,
.modal table tbody tr .dropdown-item,
.modal table tbody tr .cursor-pointer,
.modal table tbody tr [data-bs-toggle="tooltip"] {
  cursor: pointer !important;
}

/* Prevent accidental text highlight on modal 1-click select */
.modal #availableParticipantsTable tr,
.modal #recoveryUsersTableBody tr,
.modal #recoverySessionsTableBody tr,
.modal #recoveryClassesTableBody tr,
.modal #recoveryClassSessionsTableBody tr,
.modal #recoveryMaterialsTableBody tr,
.modal table tbody tr.selectable-row,
.modal table tbody tr.recovery-user-row,
.modal table tbody tr.export-participant-row,
.modal table tbody tr.export-class-row,
.modal table tbody tr.export-material-row {
  user-select: none;
  -webkit-user-select: none;
}

/* 2. Sortable Headers & General Direct Pointer Elements */
.table thead th.cursor-pointer,
.table thead th.cursor-pointer *,
th.cursor-pointer,
th.cursor-pointer *,
label.cursor-pointer,
span.cursor-pointer,
a.cursor-pointer,
button.cursor-pointer {
  cursor: pointer !important;
}

/* 3. Checkbox & Form Check Input Global Pointer Guarantee (Input Only, Cell is Default) */
.col-checkbox-cell,
th.col-checkbox-cell,
td.col-checkbox-cell,
.table th.col-checkbox-cell,
.table td.col-checkbox-cell {
  cursor: default !important;
}

input[type="checkbox"],
input[type="radio"],
.form-check-input,
.col-checkbox-cell input[type="checkbox"],
.col-checkbox-cell .form-check-input {
  cursor: pointer !important;
}

/* 4. Main Page Tables (Desktop >= 768px): Table rows & cells ALWAYS have cursor: default (Selection strictly via Checkbox or Avatar) */
@media (min-width: 768px) {

  .table:not(.modal table) tbody tr,
  .table:not(.modal table) tbody td,
  .table:not(.modal table) tbody th,
  .table:not(.modal table) .col-checkbox-cell,
  th.col-checkbox-cell,
  td.col-checkbox-cell,
  tr.participant-row,
  tr.participant-row>td,
  tr.participant-row>th,
  tr.user-row-clickable,
  tr.user-row-clickable>td,
  tr.user-row-clickable>th,
  tr.selectable-row:not(.modal tr),
  tr.selectable-row:not(.modal tr)>td,
  #participantsTable tbody tr,
  #participantsTable tbody td,
  #participantsTable .col-checkbox-cell,
  #classesTable tbody tr,
  #classesTable tbody td,
  #classesTable .col-checkbox-cell,
  #usersResultsSection table tbody tr,
  #usersResultsSection table tbody td,
  #usersResultsSection .col-checkbox-cell,
  #teamResultsSection table tbody tr,
  #teamResultsSection table tbody td,
  #teamResultsSection .col-checkbox-cell,
  #materialsTable tbody tr,
  #materialsTable tbody td,
  #materialsTable .col-checkbox-cell,
  #attendanceTable tbody tr,
  #attendanceTable tbody td,
  #attendanceTable .col-checkbox-cell,
  #tableClassParticipants tbody tr,
  #tableClassParticipants tbody td,
  #tableClassParticipants .avatar,
  #tableClassParticipants .avatar *,
  #tableClassParticipants .user-meta-info,
  #tableClassParticipants .user-meta-info *,
  #tableGlobalClasses .avatar,
  #tableGlobalClasses .avatar *,
  #tableDomisili .avatar,
  #tableDomisili .avatar * {
    cursor: default !important;
  }

  /* Interactive controls, checkboxes, avatars, and buttons strictly have pointer cursor */
  .table:not(.modal table) input[type="checkbox"]:not(:disabled),
  .table:not(.modal table) .form-check-input:not(:disabled),
  .col-checkbox-cell input[type="checkbox"]:not(:disabled),
  .col-checkbox-cell .form-check-input:not(:disabled),
  .table:not(.modal table) .selectable-avatar,
  .table:not(.modal table) .selectable-avatar *,
  .table:not(.modal table) .col-aksi *:not(:disabled):not(.disabled):not(.dropdown-menu):not(.dropdown-menu *),
  .table:not(.modal table) button:not(:disabled):not(.disabled),
  .table:not(.modal table) button:not(:disabled):not(.disabled) *,
  .table:not(.modal table) .btn:not(:disabled):not(.disabled),
  .table:not(.modal table) .btn:not(:disabled):not(.disabled) *,
  .table:not(.modal table) a:not(.disabled):not([disabled]),
  .table:not(.modal table) a:not(.disabled):not([disabled]) *,
  .table:not(.modal table) .dropdown-toggle:not(:disabled):not(.disabled),
  .table:not(.modal table) .dropdown-toggle:not(:disabled):not(.disabled) *,
  .table:not(.modal table) .dropdown-item:not(:disabled):not(.disabled),
  .table:not(.modal table) .dropdown-item:not(:disabled):not(.disabled) *,
  #participantsTable input[type="checkbox"]:not(:disabled),
  #participantsTable .form-check-input:not(:disabled),
  #participantsTable .avatar,
  #participantsTable .avatar *,
  #participantsTable .col-aksi *:not(:disabled):not(.disabled):not(.dropdown-menu):not(.dropdown-menu *),
  #participantsTable button:not(:disabled):not(.disabled),
  #participantsTable button:not(:disabled):not(.disabled) *,
  #participantsTable .btn:not(:disabled):not(.disabled),
  #participantsTable .btn:not(:disabled):not(.disabled) *,
  #participantsTable a:not(.disabled),
  #participantsTable a:not(.disabled) *,
  #classesTable input[type="checkbox"]:not(:disabled),
  #classesTable .form-check-input:not(:disabled),
  #classesTable .avatar,
  #classesTable .avatar *,
  #classesTable .col-aksi *:not(:disabled):not(.disabled):not(.dropdown-menu):not(.dropdown-menu *),
  #usersResultsSection input[type="checkbox"]:not(:disabled),
  #usersResultsSection .form-check-input:not(:disabled),
  #usersResultsSection .avatar,
  #usersResultsSection .avatar *,
  #teamResultsSection input[type="checkbox"]:not(:disabled),
  #teamResultsSection .form-check-input:not(:disabled),
  #teamResultsSection .avatar,
  #teamResultsSection .avatar *,
  #materialsTable input[type="checkbox"]:not(:disabled),
  #materialsTable .form-check-input:not(:disabled),
  #materialsTable .avatar,
  #materialsTable .avatar *,
  #attendanceTable input[type="checkbox"]:not(:disabled),
  #attendanceTable .form-check-input:not(:disabled),
  #attendanceTable .avatar,
  #attendanceTable .avatar * {
    cursor: pointer !important;
  }

  /* Dropdown Menu Containers within tables strictly default cursor */
  .table:not(.modal table) .dropdown-menu,
  .table:not(.modal table) .dropdown-menu li,
  .table:not(.modal table) .dropdown-menu ul,
  .col-aksi .dropdown-menu,
  .col-aksi .dropdown-menu li,
  .col-aksi .dropdown-menu ul {
    cursor: default !important;
  }

  /* Disabled dropdown items within tables strictly retain default cursor & zero hover background */
  .table:not(.modal table) .dropdown-item:disabled,
  .table:not(.modal table) .dropdown-item.disabled,
  .table:not(.modal table) .dropdown-item:disabled:hover,
  .table:not(.modal table) .dropdown-item.disabled:hover,
  .table:not(.modal table) .dropdown-item:disabled:focus,
  .table:not(.modal table) .dropdown-item.disabled:focus,
  .table:not(.modal table) .dropdown-item:disabled:active,
  .table:not(.modal table) .dropdown-item.disabled:active,
  .table:not(.modal table) .dropdown-menu li:has(> .dropdown-item:disabled),
  .table:not(.modal table) .dropdown-menu li:has(> .dropdown-item.disabled),
  .table:not(.modal table) .dropdown-menu li:has(> .dropdown-item:disabled):hover,
  .table:not(.modal table) .dropdown-menu li:has(> .dropdown-item.disabled):hover {
    cursor: default !important;
    pointer-events: auto !important;
    background: transparent !important;
    background-color: transparent !important;
    color: var(--bs-dropdown-link-disabled-color, #a8aaae) !important;
    box-shadow: none !important;
  }

  /* Disabled standalone buttons within tables retain standard button styling */
  .table:not(.modal table) .btn:disabled,
  .table:not(.modal table) .btn.disabled,
  .table:not(.modal table) button:disabled:not(.dropdown-item),
  .table:not(.modal table) button.disabled:not(.dropdown-item),
  .table:not(.modal table) a.btn.disabled,
  .table:not(.modal table) a.btn[disabled] {
    cursor: not-allowed !important;
    pointer-events: auto !important;
    box-shadow: none !important;
    transform: none !important;
  }

  /* Explicit light mode contrast for disabled outline secondary buttons inside tables */
  [data-bs-theme="light"] .table:not(.modal table) .btn-outline-secondary:disabled,
  [data-bs-theme="light"] .table:not(.modal table) .btn-outline-secondary.disabled,
  :root:not([data-bs-theme="dark"]) .table:not(.modal table) .btn-outline-secondary:disabled,
  :root:not([data-bs-theme="dark"]) .table:not(.modal table) .btn-outline-secondary.disabled {
    color: var(--bs-gray-500, #808080) !important;
    border-color: var(--bs-gray-200, #cccccc) !important;
    background-color: transparent !important;
  }

  [data-bs-theme="light"] .table:not(.modal table) .btn-outline-secondary:disabled *,
  [data-bs-theme="light"] .table:not(.modal table) .btn-outline-secondary.disabled *,
  :root:not([data-bs-theme="dark"]) .table:not(.modal table) .btn-outline-secondary:disabled *,
  :root:not([data-bs-theme="dark"]) .table:not(.modal table) .btn-outline-secondary.disabled * {
    color: var(--bs-gray-500, #808080) !important;
  }

  [data-bs-theme="dark"] .table:not(.modal table) .btn-outline-secondary:disabled,
  [data-bs-theme="dark"] .table:not(.modal table) .btn-outline-secondary.disabled {
    color: #8c8c8c !important;
    border-color: #404040 !important;
    background-color: transparent !important;
  }

  [data-bs-theme="dark"] .table:not(.modal table) .btn-outline-secondary:disabled *,
  [data-bs-theme="dark"] .table:not(.modal table) .btn-outline-secondary.disabled * {
    color: #8c8c8c !important;
  }

  .table:not(.modal table) .dropdown-item:disabled *,
  .table:not(.modal table) .dropdown-item.disabled *,
  .table:not(.modal table) .dropdown-item:disabled:hover *,
  .table:not(.modal table) .dropdown-item.disabled:hover *,
  .table:not(.modal table) .dropdown-item:disabled:focus *,
  .table:not(.modal table) .dropdown-item.disabled:focus *,
  .table:not(.modal table) .dropdown-menu li:has(> .dropdown-item:disabled) *,
  .table:not(.modal table) .dropdown-menu li:has(> .dropdown-item.disabled) * {
    cursor: default !important;
    pointer-events: none !important;
    background: transparent !important;
    background-color: transparent !important;
    color: inherit !important;
  }
}

/* ==========================================================================
   5. Tables Without Bulk Selection (Informational Tables & Avatars)
   All rows, cells, avatars, and user meta info have cursor: default.
   Action buttons, links, dropdowns, and sortable headers strictly retain cursor: pointer.
   ========================================================================== */
#rankingTable tbody tr,
#rankingTable tbody tr td,
#rankingTable tbody tr th,
#rankingTable .avatar,
#rankingTable .avatar *,
#rankingTable .user-meta-info,
#rankingTable .user-meta-info *,
#leaderboard-tbody tr,
#leaderboard-tbody tr td,
#leaderboard-tbody tr th,
#leaderboard-tbody .avatar,
#leaderboard-tbody .avatar *,
tr.rank-row,
tr.rank-row td,
tr.rank-row th,
tr.rank-row .avatar,
tr.rank-row .avatar *,
#tableReferralList tbody tr,
#tableReferralList tbody tr td,
#tableReferralList tbody tr th,
#tableReferralList .avatar,
#tableReferralList .avatar *,
#referralTableBody tr,
#referralTableBody tr td,
#referralTableBody tr th,
#referralTableBody .avatar,
#referralTableBody .avatar *,
tr.referral-row-clickable,
tr.referral-row-clickable td,
tr.referral-row-clickable th,
tr.referral-row-clickable .avatar,
tr.referral-row-clickable .avatar *,
#referralDetailContent table tbody tr,
#referralDetailContent table tbody tr td,
#referralDetailContent table .avatar,
#referralDetailContent table .avatar *,
#phTable tbody tr,
#phTable tbody tr td,
#phTable .avatar,
#phTable .avatar *,
#tableClassParticipants tbody tr,
#tableClassParticipants tbody td,
#tableClassParticipants .avatar,
#tableClassParticipants .avatar *,
#tableDomisili tbody tr,
#tableDomisili tbody td,
#tableDomisili .avatar,
#tableDomisili .avatar *,
#tableGlobalClasses tbody tr,
#tableGlobalClasses tbody td,
#tableGlobalClasses .avatar,
#tableGlobalClasses .avatar *,
#auditLogsTable tbody tr,
#auditLogsTable tbody td,
#auditLogsTable .avatar,
#auditLogsTable .avatar *,
#tableBroadcastHistory tbody tr,
#tableBroadcastHistory tbody td,
#tableBroadcastHistory .avatar,
#tableBroadcastHistory .avatar *,
#bugReportsTable tbody tr,
#bugReportsTable tbody td,
#bugReportsTable .avatar,
#bugReportsTable .avatar *,
#userActivityTable tbody tr,
#userActivityTable tbody td,
#userActivityTable .avatar,
#userActivityTable .avatar *,
#shortenerTable tbody tr,
#shortenerTable tbody td,
#shortenerTable .avatar,
#shortenerTable .avatar *,
#activeUsersTable tbody tr,
#activeUsersTable tbody td,
#activeUsersTable .avatar,
#activeUsersTable .avatar *,
#contentTable tbody tr,
#contentTable tbody td,
#popupsTable tbody tr,
#popupsTable tbody td,
#guidesTable tbody tr,
#guidesTable tbody td,
#faqTable tbody tr,
#faqTable tbody td,
#avatarTemplatesTable tbody tr,
#avatarTemplatesTable tbody td,
#accessControlTable tbody tr,
#accessControlTable tbody td,
#envEditorTable tbody tr,
#envEditorTable tbody td,
#table-class-sessions-desktop tbody tr,
#table-class-sessions-desktop tbody td,
#tableRepeatTrackingModal tbody tr,
#tableRepeatTrackingModal tbody td,
#tableUnfilledSessionsModal tbody tr,
#tableUnfilledSessionsModal tbody td {
  cursor: default !important;
}

/* Explicit interactive controls inside non-bulk tables */
#rankingTable button,
#rankingTable button *,
#rankingTable .btn,
#rankingTable .btn *,
#rankingTable a,
#rankingTable a *,
#rankingTable th.cursor-pointer,
#rankingTable th.cursor-pointer *,
#rankingTable .ranking-sortable-header,
#rankingTable .ranking-sortable-header *,
#leaderboard-tbody .btn-detail-point,
#leaderboard-tbody .btn-detail-point *,
#tableReferralList button,
#tableReferralList button *,
#tableReferralList .btn,
#tableReferralList .btn *,
#tableReferralList a,
#tableReferralList a *,
#tableReferralList th.cursor-pointer,
#tableReferralList th.cursor-pointer *,
#tableReferralList .referral-sortable-header,
#tableReferralList .referral-sortable-header *,
#referralTableBody [data-ssr-btn-detail],
#referralTableBody [data-ssr-btn-detail] *,
#referralTableBody [data-btn-detail],
#referralTableBody [data-btn-detail] *,
#auditLogsTable button,
#auditLogsTable .btn,
#auditLogsTable a,
#tableBroadcastHistory button,
#tableBroadcastHistory .btn,
#bugReportsTable button,
#bugReportsTable .btn,
#shortenerTable button,
#shortenerTable .btn,
#activeUsersTable button,
#activeUsersTable .btn,
#contentTable button,
#contentTable .btn,
#accessControlTable button,
#accessControlTable .btn,
#accessControlTable input[type="checkbox"],
#table-class-sessions-desktop button,
#table-class-sessions-desktop .btn,
#table-class-sessions-desktop a {
  cursor: pointer !important;
}

/* 4. Mobile Screen (< 768px): Row is clickable for user detail modal */
@media (max-width: 767.98px) {

  .participant-row-clickable,
  .participant-row-clickable *,
  .user-row-clickable,
  .user-row-clickable * {
    cursor: pointer;
  }
}

/* ==========================================================================
   8. Standard Spacious Empty State System (Across All Pages)
   Strictly Monochrome Icons, Clean Single Headings, Standardized Size & Padding
   ========================================================================== */
.table tbody td.table-empty-state,
.table tbody td.table-loading-state,
table tbody tr td.table-empty-state,
table tbody tr td.table-loading-state,
.table tbody tr:has(.table-empty-state) td,
.table tbody tr:has(.table-empty-state-container) td,
.table-responsive .table-empty-state,
.table-responsive .table-loading-state {
  min-height: auto !important;
  padding-top: 4rem !important;
  padding-bottom: 4rem !important;
  padding-left: 1.5rem !important;
  padding-right: 1.5rem !important;
  vertical-align: middle !important;
  text-align: center !important;
}

.table-empty-state-container,
.table-loading-state-container,
.table-empty-state .table-empty-state-inner,
.table-loading-state .table-loading-state-inner {
  min-height: 150px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
  gap: 0.75rem !important;
  text-align: center !important;
}

/* ==========================================================================
   Universal Empty State Styling (Icon & Text Unified Monochrome)
   Ensures icon and text have 100% IDENTICAL secondary color and opacity,
   with normal (non-bold) font weight across cards and tables.
   ========================================================================== */

/* 1. Icon: Monochrome, prominent clean standard size, identical secondary color */
.table-empty-state-container>i,
.table-empty-state-container>.material-symbols-outlined,
.table-empty-state-container i,
.table-empty-state-container .material-symbols-outlined,
.table-empty-state>i,
.table-empty-state>.material-symbols-outlined,
.table-empty-state svg,
.table-empty-state-container svg,
.icon-empty-state,
.notification-empty-state i,
.notification-empty-state .material-symbols-outlined,
.notes-book-empty i,
.notes-book-empty .material-symbols-outlined {
  font-size: 3.25rem !important;
  width: 3.25rem !important;
  height: 3.25rem !important;
  color: var(--bs-secondary-color, #707070) !important;
  opacity: 1 !important;
  margin: 0 auto 0.5rem auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
}

/* 2. Text: Standard typography, normal font-weight (NOT bold), identical secondary color */
.table-empty-state p,
.table-empty-state-container p,
.table-empty-state span:not(.material-symbols-outlined),
.table-empty-state-container span:not(.material-symbols-outlined),
.table-empty-state h6,
.table-empty-state-container h6,
.table-empty-state h5,
.table-empty-state-container h5,
.notification-empty-state p,
.notification-empty-state h6,
.notes-book-empty p,
.notes-book-empty h6,
.notes-book-empty span:not(.material-symbols-outlined) {
  font-size: 0.9375rem !important;
  font-weight: 400 !important;
  /* Normal weight - not bold */
  color: var(--bs-secondary-color, #707070) !important;
  opacity: 1 !important;
  margin: 0 !important;
  line-height: 1.45 !important;
  letter-spacing: normal !important;
  text-align: center !important;
}

/* Override any inline or inherited utility bold classes inside empty states */
.table-empty-state .fw-bold,
.table-empty-state .fw-semibold,
.table-empty-state-container .fw-bold,
.table-empty-state-container .fw-semibold,
.notification-empty-state .fw-bold,
.notification-empty-state .fw-semibold,
.notes-book-empty .fw-bold,
.notes-book-empty .fw-semibold {
  font-weight: 400 !important;
}

/* 3. Dark Mode: Uniform matching color for BOTH icon and text */
[data-bs-theme="dark"] .table-empty-state-container>i,
[data-bs-theme="dark"] .table-empty-state-container>.material-symbols-outlined,
[data-bs-theme="dark"] .table-empty-state-container i,
[data-bs-theme="dark"] .table-empty-state-container .material-symbols-outlined,
[data-bs-theme="dark"] .table-empty-state>i,
[data-bs-theme="dark"] .table-empty-state>.material-symbols-outlined,
[data-bs-theme="dark"] .table-empty-state svg,
[data-bs-theme="dark"] .table-empty-state-container svg,
[data-bs-theme="dark"] .table-empty-state p,
[data-bs-theme="dark"] .table-empty-state span:not(.material-symbols-outlined),
[data-bs-theme="dark"] .table-empty-state h6,
[data-bs-theme="dark"] .table-empty-state h5,
[data-bs-theme="dark"] .table-empty-state-container p,
[data-bs-theme="dark"] .table-empty-state-container span:not(.material-symbols-outlined),
[data-bs-theme="dark"] .table-empty-state-container h6,
[data-bs-theme="dark"] .table-empty-state-container h5,
[data-bs-theme="dark"] .icon-empty-state,
[data-bs-theme="dark"] .notification-empty-state i,
[data-bs-theme="dark"] .notification-empty-state .material-symbols-outlined,
[data-bs-theme="dark"] .notification-empty-state p,
[data-bs-theme="dark"] .notification-empty-state h6,
[data-bs-theme="dark"] .notes-book-empty i,
[data-bs-theme="dark"] .notes-book-empty .material-symbols-outlined,
[data-bs-theme="dark"] .notes-book-empty p,
[data-bs-theme="dark"] .notes-book-empty h6,
html.dark-style .table-empty-state-container>i,
html.dark-style .table-empty-state-container>.material-symbols-outlined,
html.dark-style .table-empty-state-container i,
html.dark-style .table-empty-state-container .material-symbols-outlined,
html.dark-style .table-empty-state p,
html.dark-style .table-empty-state-container p {
  color: var(--bs-secondary-color, rgba(255, 255, 255, 0.55)) !important;
  opacity: 1 !important;
  font-weight: 400 !important;
}

/* Hide secondary descriptions below heading in empty cards and tables if multiple p/h tags exist */
.table-empty-state-container:has(h6) p,
.table-empty-state-container:has(h5) p,
.table-empty-state:has(h6) p,
.table-empty-state:has(h5) p,
.table-empty-state-container h6~p,
.table-empty-state-container h5~p,
.table-empty-state h6~p,
.table-empty-state h5~p {
  display: none !important;
}

@media (max-width: 767.98px) {

  .table:has(.table-empty-state) thead,
  .table-responsive:has(.table-empty-state) thead {
    display: none !important;
  }

  .table tbody td.table-empty-state,
  .table tbody td.table-loading-state,
  table tbody tr td.table-empty-state,
  table tbody tr td.table-loading-state,
  .table tbody tr:has(.table-empty-state) td,
  .table tbody tr:has(.table-empty-state-container) td,
  .table-responsive .table-empty-state,
  .table-responsive .table-loading-state {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    border: none !important;
  }

  /* Empty state cards that do not contain tables or tab-content */
  .card:not(:has(.table-responsive)):not(:has(table)):not(:has(.tab-content)):has(.table-empty-state-container),
  .card.py-4:not(:has(.table-responsive)):not(:has(table)):not(:has(.tab-content)):has(.table-empty-state-container) {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .table-empty-state-container,
  .table-loading-state-container,
  .table-empty-state .table-empty-state-inner,
  .table-loading-state .table-loading-state-inner {
    min-height: 130px !important;
    gap: 0.65rem !important;
  }

  .table-empty-state-container>i,
  .table-empty-state-container>.material-symbols-outlined,
  .table-empty-state-container i,
  .table-empty-state-container .material-symbols-outlined,
  .table-empty-state>i,
  .table-empty-state>.material-symbols-outlined,
  .table-empty-state svg,
  .table-empty-state-container svg {
    font-size: 2.75rem !important;
    width: 2.75rem !important;
    height: 2.75rem !important;
    margin: 0 auto 0.4rem auto !important;
    opacity: 1 !important;
  }
}

/* ========================================================
 * Standardized Table & Filter Loading Container
 * Ultra-subtle (opacity: 0.85) & Snappy (0.08s transition)
 * ======================================================== */
.table-container-loading {
  opacity: 0.85 !important;
  pointer-events: none !important;
  transition: opacity 0.08s cubic-bezier(0.4, 0, 0.2, 1) !important;
  user-select: none !important;
}

/* ==========================================================================
 * Horizontally Scrollable Tables on Mobile (Log & Pemantauan / Category Tables)
 * Preserves exact desktop layout, column widths, avatars & badges on mobile
 * ========================================================================== */
@media (max-width: 767.98px) {

  .table-scroll-horizontal,
  .table-scroll-horizontal.table-responsive,
  .audit-table-wrapper,
  .audit-table-wrapper.table-responsive,
  #auditLogsResultsSection .audit-table-wrapper,
  #auditLogsResultsSection .table-responsive,
  .email-table-wrapper,
  .email-table-wrapper.table-responsive,
  .system-settings-table-wrapper,
  .system-settings-table-wrapper.table-responsive,
  .env-editor-table-wrapper,
  .env-editor-table-wrapper.table-responsive,
  .db-backup-table-wrapper,
  .db-backup-table-wrapper.table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
    position: relative;
    overscroll-behavior-x: contain;
    display: block !important;
  }

  .table-scroll-horizontal .table,
  .table-scroll-horizontal .table.table-no-stack,
  .audit-table-wrapper .table,
  .audit-table-wrapper .table.table-no-stack,
  #auditLogsResultsSection .table,
  #auditLogsResultsSection .table.table-no-stack,
  .email-table-wrapper .table,
  .email-table-wrapper .table.table-no-stack,
  .system-settings-table-wrapper .table,
  .system-settings-table-wrapper .table.table-no-stack,
  .env-editor-table-wrapper .table,
  .env-editor-table-wrapper .table.table-no-stack,
  .db-backup-table-wrapper .table,
  .db-backup-table-wrapper .table.table-no-stack {
    width: max-content !important;
    min-width: 860px !important;
    max-width: none !important;
    table-layout: auto !important;
  }

  /* Specific minimum width for tables with fewer/more columns */
  .email-table-wrapper .table,
  .email-table-wrapper .table.table-no-stack {
    min-width: 720px !important;
  }

  .system-settings-table-wrapper .table,
  .system-settings-table-wrapper .table.table-no-stack {
    min-width: 760px !important;
  }

  .env-editor-table-wrapper .table,
  .env-editor-table-wrapper .table.table-no-stack,
  #envEditorTable {
    min-width: 650px !important;
  }

  .db-backup-table-wrapper .table,
  .db-backup-table-wrapper .table.table-no-stack {
    min-width: 700px !important;
  }

  /* When empty state is shown, allow it to span cleanly without horizontal scroll */
  .table-scroll-horizontal .table:has(.table-empty-state),
  .audit-table-wrapper .table:has(.table-empty-state),
  #auditLogsResultsSection .table:has(.table-empty-state),
  .email-table-wrapper .table:has(.table-empty-state),
  .bug-reports-table-wrapper .table:has(.table-empty-state),
  .system-settings-table-wrapper .table:has(.table-empty-state),
  .env-editor-table-wrapper .table:has(.table-empty-state),
  .db-backup-table-wrapper .table:has(.table-empty-state) {
    min-width: 100% !important;
    width: 100% !important;
  }

  /* Reset forced cell squishing (max-width: 0) and clipping from mobile app.css */
  .table-scroll-horizontal .table td,
  .table-scroll-horizontal .table th,
  .table-scroll-horizontal .table.table-no-stack td,
  .table-scroll-horizontal .table.table-no-stack th,
  .table-scroll-horizontal .table.table-no-stack td:not(.col-checkbox-cell),
  .audit-table-wrapper .table td,
  .audit-table-wrapper .table th,
  .audit-table-wrapper .table.table-no-stack td,
  .audit-table-wrapper .table.table-no-stack th,
  .audit-table-wrapper .table.table-no-stack td:not(.col-checkbox-cell),
  #auditLogsResultsSection .table td,
  #auditLogsResultsSection .table th,
  #auditLogsResultsSection .table.table-no-stack td,
  #auditLogsResultsSection .table.table-no-stack th,
  #auditLogsResultsSection .table.table-no-stack td:not(.col-checkbox-cell),
  .email-table-wrapper .table td,
  .email-table-wrapper .table th,
  .email-table-wrapper .table.table-no-stack td,
  .email-table-wrapper .table.table-no-stack th,
  .bug-reports-table-wrapper .table td,
  .bug-reports-table-wrapper .table th,
  .bug-reports-table-wrapper .table.table-no-stack td,
  .bug-reports-table-wrapper .table.table-no-stack th,
  .system-settings-table-wrapper .table td,
  .system-settings-table-wrapper .table th,
  .system-settings-table-wrapper .table.table-no-stack td,
  .system-settings-table-wrapper .table.table-no-stack th,
  .env-editor-table-wrapper .table td,
  .env-editor-table-wrapper .table th,
  .env-editor-table-wrapper .table.table-no-stack td,
  .env-editor-table-wrapper .table.table-no-stack th,
  .db-backup-table-wrapper .table td,
  .db-backup-table-wrapper .table th,
  .db-backup-table-wrapper .table.table-no-stack td,
  .db-backup-table-wrapper .table.table-no-stack th {
    max-width: none !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  /* Keep table headers and text-nowrap elements strictly on one line */
  .table-scroll-horizontal .table thead th,
  .audit-table-wrapper .table thead th,
  .email-table-wrapper .table thead th,
  .bug-reports-table-wrapper .table thead th,
  .system-settings-table-wrapper .table thead th,
  .env-editor-table-wrapper .table thead th,
  .db-backup-table-wrapper .table thead th,
  .table-scroll-horizontal .table th.text-nowrap,
  .table-scroll-horizontal .table td.text-nowrap,
  .audit-table-wrapper .table th.text-nowrap,
  .audit-table-wrapper .table td.text-nowrap,
  .email-table-wrapper .table th.text-nowrap,
  .email-table-wrapper .table td.text-nowrap,
  .bug-reports-table-wrapper .table th.text-nowrap,
  .bug-reports-table-wrapper .table td.text-nowrap,
  .system-settings-table-wrapper .table th.text-nowrap,
  .system-settings-table-wrapper .table td.text-nowrap,
  .env-editor-table-wrapper .table th.text-nowrap,
  .env-editor-table-wrapper .table td.text-nowrap,
  .db-backup-table-wrapper .table th.text-nowrap,
  .db-backup-table-wrapper .table td.text-nowrap {
    white-space: nowrap !important;
  }

  /* Ensure badges and action buttons in log tables do not wrap or clip */
  .table-scroll-horizontal .table .badge,
  .audit-table-wrapper .table .badge,
  .email-table-wrapper .table .badge,
  .bug-reports-table-wrapper .table .badge {
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center;
  }

  .table-scroll-horizontal .table .btn-sm,
  .audit-table-wrapper .table .btn-sm,
  .email-table-wrapper .table .btn-sm,
  .bug-reports-table-wrapper .table .btn-sm {
    white-space: nowrap !important;
  }

  /* Compact User Meta (.user-meta-compact) in audit tables */
  .table-scroll-horizontal .user-meta-compact,
  .audit-table-wrapper .user-meta-compact {
    min-width: 175px !important;
    width: max-content !important;
    max-width: 250px !important;
  }

  .table-scroll-horizontal .user-meta-compact .user-name,
  .audit-table-wrapper .user-meta-compact .user-name {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 180px !important;
    font-weight: 600 !important;
  }

  .table-scroll-horizontal .user-meta-compact .user-id,
  .audit-table-wrapper .user-meta-compact .user-id {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 180px !important;
  }

  /* Standard User Meta (.user-meta-info) */
  .table-scroll-horizontal .user-meta-info,
  .audit-table-wrapper .user-meta-info,
  .bug-reports-table-wrapper .user-meta-info {
    min-width: 175px !important;
    width: max-content !important;
  }

  .table-scroll-horizontal .user-meta-info .user-name,
  .audit-table-wrapper .user-meta-info .user-name,
  .bug-reports-table-wrapper .user-meta-info .user-name {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 180px !important;
    font-weight: 600 !important;
  }

  .table-scroll-horizontal .user-meta-info .user-id,
  .audit-table-wrapper .user-meta-info .user-id,
  .bug-reports-table-wrapper .user-meta-info .user-id {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 180px !important;
  }

  /* Activity description / chronology column readable width */
  .audit-table-wrapper .table td:last-child {
    min-width: 250px;
    white-space: normal;
  }
}

/* ==========================================================================
   Standardized Responsive Name / NIS Column Across All Tables
   Controlled width, no blowout, and clean ellipsis (...) on long names
   ========================================================================== */
@media (min-width: 768px) {

  .col-participant-name,
  .col-user-name,
  .table:not(#rankingTable) th.col-participant-name,
  .table:not(#rankingTable) td.col-participant-name,
  .table:not(#rankingTable) td:has(.user-meta-info),
  #participantsTable td.col-participant-name,
  #tableReferralList td:first-child,
  #tableClassParticipants td:nth-child(2) {
    max-width: 220px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
}

@media (max-width: 767.98px) {

  .table.table-no-stack td:has(.user-meta-info),
  #participantsTable td.col-participant-name {
    width: 100% !important;
    max-width: none !important;
  }
}

.table .user-meta-info {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.table .user-meta-info .user-name,
.table .user-name {
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.table .user-meta-info .user-name span,
.table .user-name span,
.table .user-meta-info .user-name .text-truncate {
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block !important;
}

.table .user-meta-info .user-id,
.table .user-id {
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* ==========================================================================
   Table Avatar Proportional Locking (Guarantees Perfectly Circular Avatars)
   ========================================================================== */
.table td .avatar,
#rankingTable .avatar {
  flex-shrink: 0 !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
}

.table td .avatar.avatar-md,
#rankingTable .avatar.avatar-md {
  --bs-avatar-size: 38px !important;
  width: var(--bs-avatar-size, 38px) !important;
  height: var(--bs-avatar-size, 38px) !important;
  min-width: var(--bs-avatar-size, 38px) !important;
  max-width: var(--bs-avatar-size, 38px) !important;
  min-height: var(--bs-avatar-size, 38px) !important;
  max-height: var(--bs-avatar-size, 38px) !important;
  flex: 0 0 var(--bs-avatar-size, 38px) !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
}

@media (max-width: 767.98px) {

  .table td .avatar.avatar-md,
  #rankingTable .avatar.avatar-md {
    --bs-avatar-size: 34px !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    flex: 0 0 34px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
  }
}

/* ==========================================================================
   Bug Reports Mobile Card Layout (< 768px)
   Transforms bug report table rows into native, touch-friendly cards
   ========================================================================== */
@media (max-width: 767.98px) {
  #bugReportsResultsSection .card {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
  }

  .bug-reports-table-wrapper {
    overflow-x: visible !important;
    overflow-y: visible !important;
    width: 100% !important;
    padding: 0 !important;
  }

  .bug-reports-table-wrapper #bugReportsTable {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    display: block !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }

  .bug-reports-table-wrapper #bugReportsTable thead {
    display: none !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.875rem !important;
    width: 100% !important;
    overflow: visible !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row {
    display: flex !important;
    flex-direction: column !important;
    background-color: var(--bs-card-bg) !important;
    border: none !important;
    border-radius: var(--bs-card-border-radius, var(--bs-border-radius-xl, 1.25rem)) !important;
    padding: 1.15rem 1.25rem !important;
    gap: 0.65rem !important;
    box-shadow: none !important;
    position: relative !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  /* 1. Sembunyikan Nomor Urut pada Mobile Card */
  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-no {
    display: none !important;
  }

  /* 2. Pelapor (Avatar + Nama + ID) */
  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-reporter {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
    padding-right: 110px !important; /* Ruang untuk badge status di kanan atas */
  }

  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-reporter .user-meta-info {
    max-width: 100% !important;
  }

  /* 3. Status Badge: Menempel di pojok kanan atas Card */
  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-status {
    position: absolute !important;
    top: 1.15rem !important;
    right: 1.25rem !important;
    padding: 0 !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-status .badge {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.75rem !important;
    border-radius: var(--bs-border-radius-pill, 50rem) !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* 4. Waktu Kejadian: Rata Inline & Center Vertikal dengan Warna Seragam */
  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-time {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-time > div {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.85rem !important;
    flex-wrap: wrap !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-time span.incident-date,
  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-time span.incident-time {
    display: inline-flex !important;
    align-items: center !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    color: var(--bs-secondary-color) !important;
    line-height: 1 !important;
    margin: 0 !important;
    gap: 0.35rem !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-time span .material-symbols-outlined {
    font-size: 1rem !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    color: var(--bs-secondary-color) !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* 5. Aksi Card di Bagian Bawah: Tombol Balas Utama + Titik Tiga Standar e-RSA */
  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-actions {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    border-top: none !important;
    width: 100% !important;
    margin-top: 0.35rem !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-actions .bug-mobile-chronology {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-size: 0.8125rem !important;
    line-height: 1.5 !important;
    margin-bottom: 0.85rem !important;
    color: var(--bs-secondary-color) !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-actions .bug-action-btn-group {
    display: flex !important;
    width: 100% !important;
    gap: 0.5rem !important;
    align-items: center !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tr.bug-report-row td.col-actions .dropdown {
    position: relative !important;
    flex-shrink: 0 !important;
  }

  /* Empty state */
  .bug-reports-table-wrapper #bugReportsTable tr#bugNoResultsRow {
    display: none;
  }

  .bug-reports-table-wrapper #bugReportsTable tr#bugNoResultsRow[style*="display: none"] {
    display: none !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tr#bugNoResultsRow:not([style*="display: none"]),
  .bug-reports-table-wrapper #bugReportsTable tr:has(.table-empty-state) {
    display: block !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .bug-reports-table-wrapper #bugReportsTable tr#bugNoResultsRow:not([style*="display: none"]) td,
  .bug-reports-table-wrapper #bugReportsTable tr:has(.table-empty-state) td {
    display: block !important;
    width: 100% !important;
    border: none !important;
    padding: 3rem 1rem !important;
  }
}
