/* Macsullg ERP unified table design system */
:root {
  --erp-table-navy: #172b4d;
  --erp-table-blue: #2563eb;
  --erp-table-muted: #64748b;
  --erp-table-line: #e3e9f1;
  --erp-table-soft: #f5f8fc;
  --erp-table-hover: #eef5ff;
  --erp-table-white: #ffffff;
}

/* First-paint protection: active before JavaScript enhances each table. */
html.erp-tables-booting body .content-wrapper table.table:not(.invoice-table):not(.table-form):not([data-erp-table="off"]) {
  width: 100% !important;
  margin: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  color: #334155;
  background: #fff;
}

html.erp-tables-booting body .content-wrapper table.table:not(.invoice-table):not(.table-form):not([data-erp-table="off"]) thead th {
  vertical-align: middle !important;
  padding: 12px 11px !important;
  border: 0 !important;
  border-bottom: 1px solid #d9e2ee !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
  font-size: 10px !important;
  line-height: 1.25;
  font-weight: 800 !important;
  letter-spacing: .055em;
  text-transform: uppercase;
  text-align: left !important;
  white-space: nowrap;
}

html.erp-tables-booting body .content-wrapper table.table:not(.invoice-table):not(.table-form):not([data-erp-table="off"]) tbody td {
  padding: 10px 11px !important;
  vertical-align: middle !important;
  border: 0 !important;
  border-bottom: 1px solid #edf1f6 !important;
  color: #3d4b60;
  font-size: 12px;
  line-height: 1.35;
  text-align: left !important;
  background: #fff;
}

html.erp-tables-booting body .content-wrapper table.table:not(.invoice-table):not(.table-form):not([data-erp-table="off"]) tbody tr:nth-child(even) td {
  background: #fbfcfe;
}

html.erp-tables-booting body .content-wrapper table.table:not(.invoice-table):not(.table-form):not([data-erp-table="off"]) tbody tr:hover td {
  background: var(--erp-table-hover) !important;
}

/*
 * DataTables creates its search, paging and wrapper markup in the footer.
 * Cloak known listing tables until that one-time conversion is complete so
 * users never see the legacy table immediately before the finished component.
 */
html.erp-tables-booting body .content-wrapper table:is(#example, #example1, #datatable, #mexample, #exam22ple) {
  visibility: hidden !important;
}

@supports selector(.card-body:has(table)) {
  html.erp-tables-booting body .content-wrapper .card-body:has(> table:is(#example, #example1, #datatable, #mexample, #exam22ple)) {
    position: relative;
    min-height: 190px;
    overflow: hidden;
  }

  html.erp-tables-booting body .content-wrapper .card-body:has(> table:is(#example, #example1, #datatable, #mexample, #exam22ple))::before {
    content: "Loading records…";
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 72px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    background:
      linear-gradient(90deg, transparent, rgba(255, 255, 255, .72), transparent) -220px 0/220px 100% no-repeat,
      linear-gradient(#f1f5f9 0 0) 14px 18px/calc(100% - 28px) 40px no-repeat,
      repeating-linear-gradient(to bottom, #fff 0, #fff 38px, #edf1f6 39px, #edf1f6 40px) 14px 58px/calc(100% - 28px) 120px no-repeat,
      #fff;
    animation: erp-table-loading-sweep 1.15s linear infinite;
  }
}

@keyframes erp-table-loading-sweep {
  to {
    background-position: calc(100% + 220px) 0, 14px 18px, 14px 58px, 0 0;
  }
}

.erp-table-shell {
  position: relative;
  margin: 0 0 1.25rem;
  border: 1px solid var(--erp-table-line);
  border-radius: 12px;
  background: var(--erp-table-white);
  box-shadow: 0 4px 16px rgba(15, 23, 42, .045);
  overflow: hidden;
}

.erp-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--erp-table-line);
  background: #fff;
}

.erp-table-toolbar-left,
.erp-table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.erp-table-count {
  color: var(--erp-table-muted);
  font-size: 12px;
  white-space: nowrap;
}

.erp-table-count strong {
  color: var(--erp-table-navy);
  font-size: 13px;
}

.erp-table-search {
  position: relative;
  min-width: 245px;
}

.erp-table-search i {
  position: absolute;
  top: 11px;
  left: 11px;
  color: #94a3b8;
  font-size: 12px;
  pointer-events: none;
}

.erp-table-search input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 32px;
  border: 1px solid #d9e1ec;
  border-radius: 8px;
  background: #f8fafc;
  color: #24324a;
  font-size: 12px;
  outline: 0;
  transition: .16s ease;
}

.erp-table-search input:focus {
  background: #fff;
  border-color: #8bb0fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.erp-table-search-clear {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  display: none;
}

.erp-table-search-clear:hover {
  color: var(--erp-table-blue);
  background: #eaf1ff;
}

.erp-table-tool,
.erp-table-length select {
  height: 34px;
  border: 1px solid #d9e1ec;
  border-radius: 7px;
  background: #fff;
  color: #526176;
  font-size: 11px;
  font-weight: 700;
}

.erp-table-tool {
  min-width: 34px;
  padding: 0 10px;
}

.erp-table-tool:hover,
.erp-table-tool.active {
  color: var(--erp-table-blue);
  border-color: #9bb9f7;
  background: #f1f6ff;
}

.erp-table-length {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #7b8799;
  font-size: 11px;
}

.erp-table-length select {
  padding: 0 23px 0 8px;
}

.erp-table-scroll {
  width: 100%;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #bcc8d8 transparent;
}

/* Specificity intentionally overrides the old global black table borders. */
body .erp-data-table.table {
  width: 100% !important;
  margin: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  color: #334155;
  background: #fff;
}

body .erp-data-table.table.table-responsive {
  display: table !important;
  overflow: visible !important;
}

body .erp-data-table.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  vertical-align: middle !important;
  padding: 12px 11px !important;
  border: 0 !important;
  border-bottom: 1px solid #d9e2ee !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
  font-size: 10px !important;
  line-height: 1.25;
  font-weight: 800 !important;
  letter-spacing: .055em;
  text-transform: uppercase;
  text-align: left !important;
  white-space: nowrap;
}

body .erp-data-table.table thead th.erp-sortable {
  padding-right: 25px !important;
  cursor: pointer;
  user-select: none;
}

body .erp-data-table.table thead th.erp-sortable:after {
  content: '\f0dc';
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font: 900 10px "Font Awesome 5 Free";
  color: #a4afbd;
}

body .erp-data-table.table thead th.erp-sort-asc:after {
  content: '\f0de';
  color: var(--erp-table-blue);
}

body .erp-data-table.table thead th.erp-sort-desc:after {
  content: '\f0dd';
  color: var(--erp-table-blue);
}

body .erp-data-table.table tbody td {
  padding: 10px 11px !important;
  vertical-align: middle !important;
  border: 0 !important;
  border-bottom: 1px solid #edf1f6 !important;
  color: #3d4b60;
  font-size: 12px;
  line-height: 1.35;
  text-align: left !important;
  background: #fff;
  transition: background .12s ease;
}

body .erp-data-table.table tbody tr:nth-child(even) td {
  background: #fbfcfe;
}

body .erp-data-table.table tbody tr:hover td {
  background: var(--erp-table-hover) !important;
}

body .erp-data-table.table tbody tr:last-child td {
  border-bottom: 0 !important;
}

body .erp-data-table.table .erp-cell-number {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body .erp-data-table.table .erp-cell-center {
  text-align: center !important;
}

body .erp-data-table.table .erp-cell-primary {
  color: var(--erp-table-navy);
  font-weight: 700;
}

body .erp-data-table.table.table-compact tbody td {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

body .erp-data-table.table.table-compact thead th {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

.erp-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.25;
  font-weight: 800;
  white-space: nowrap;
}

.erp-status:before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
}

.erp-status-success {
  color: #047857;
  background: #ecfdf5;
}

.erp-status-warning {
  color: #a16207;
  background: #fffbeb;
}

.erp-status-danger {
  color: #be123c;
  background: #fff1f2;
}

.erp-status-info {
  color: #1d4ed8;
  background: #eff6ff;
}

.erp-status-muted {
  color: #64748b;
  background: #f1f5f9;
}

body .erp-data-table.table td .btn {
  min-height: 29px;
  padding: 5px 8px;
  border-radius: 6px;
  border-width: 1px;
  font-size: 10px;
  font-weight: 700;
  box-shadow: none !important;
}

body .erp-data-table.table td .btn+.btn {
  margin-left: 3px;
}

body .erp-data-table.table td .btn-info {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

body .erp-data-table.table td .btn-success {
  color: #047857;
  border-color: #a7f3d0;
  background: #ecfdf5;
}

body .erp-data-table.table td .btn-warning {
  color: #92400e;
  border-color: #fde68a;
  background: #fffbeb;
}

body .erp-data-table.table td .btn-danger {
  color: #be123c;
  border-color: #fecdd3;
  background: #fff1f2;
}

body .erp-data-table.table td .btn-primary {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

body .erp-data-table.table td .btn:hover {
  filter: brightness(.97);
  transform: translateY(-1px);
}

.erp-table-empty {
  display: none;
  padding: 45px 20px;
  text-align: center;
  color: #8795a8;
}

.erp-table-empty i {
  display: block;
  margin-bottom: 10px;
  color: #b4c0cf;
  font-size: 26px;
}

.erp-table-empty strong {
  display: block;
  margin-bottom: 3px;
  color: #526176;
  font-size: 13px;
}

.erp-table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 53px;
  padding: 9px 14px;
  border-top: 1px solid var(--erp-table-line);
  background: #fff;
}

.erp-table-info {
  color: #7b8799;
  font-size: 11px;
}

.erp-table-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.erp-table-page {
  min-width: 31px;
  height: 31px;
  padding: 0 7px;
  border: 1px solid #dce4ee;
  border-radius: 6px;
  background: #fff;
  color: #607086;
  font-size: 11px;
  font-weight: 700;
}

.erp-table-page:hover:not(:disabled),
.erp-table-page.active {
  color: #fff;
  border-color: var(--erp-table-blue);
  background: var(--erp-table-blue);
}

.erp-table-page:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* DataTables integration */
.dataTables_wrapper {
  color: #536176;
}

.dataTables_wrapper .row:first-child {
  align-items: center;
  padding: 10px 13px;
  border: 1px solid var(--erp-table-line);
  border-bottom: 0;
  border-radius: 11px 11px 0 0;
  background: #fff;
}

.dataTables_wrapper .row:last-child {
  align-items: center;
  margin: 0;
  padding: 9px 13px;
  border: 1px solid var(--erp-table-line);
  border-top: 0;
  border-radius: 0 0 11px 11px;
  background: #fff;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  margin: 0;
  color: #718096;
  font-size: 11px;
  font-weight: 600 !important;
}

.dataTables_wrapper .dataTables_length select {
  height: 34px;
  margin: 0 5px;
  border: 1px solid #d9e1ec;
  border-radius: 7px;
  background: #f8fafc;
  font-size: 11px;
}

.dataTables_wrapper .dataTables_filter input {
  width: 235px !important;
  height: 35px;
  margin-left: 7px;
  padding: 0 11px;
  border: 1px solid #d9e1ec !important;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
  outline: 0;
}

.dataTables_wrapper .dataTables_filter input:focus {
  background: #fff;
  border-color: #8bb0fa !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.dataTables_wrapper .dataTables_info {
  color: #7b8799 !important;
  font-size: 11px;
}

.dataTables_wrapper .pagination {
  gap: 3px;
}

.dataTables_wrapper .page-link {
  min-width: 31px;
  height: 31px;
  padding: 6px 8px;
  border-radius: 6px !important;
  border: 1px solid #dce4ee;
  color: #607086;
  font-size: 11px;
  text-align: center;
}

.dataTables_wrapper .page-item.active .page-link {
  border-color: var(--erp-table-blue);
  background: var(--erp-table-blue);
  color: #fff;
}

.dataTables_wrapper .dt-buttons .btn {
  height: 33px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid #cfe0ff;
  background: #f1f6ff;
  color: #2563eb;
  font-size: 10px;
  font-weight: 800;
}

.erp-table-shell.is-fullscreen {
  position: fixed;
  inset: 12px;
  z-index: 1060;
  margin: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .25);
}

.erp-table-shell.is-fullscreen .erp-table-scroll {
  flex: 1;
}

body.erp-table-fullscreen-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .erp-table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .erp-table-toolbar-left,
  .erp-table-toolbar-right {
    width: 100%;
  }

  .erp-table-search {
    flex: 1;
    min-width: 0;
  }

  .erp-table-count {
    display: none;
  }

  .erp-table-footer {
    gap: 8px;
    flex-direction: column;
  }

  .dataTables_wrapper .row:first-child>div {
    margin: 4px 0;
  }

  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length {
    text-align: left !important;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: calc(100% - 52px) !important;
  }

  body .erp-data-table.erp-mobile-cards thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  body .erp-data-table.erp-mobile-cards,
  body .erp-data-table.erp-mobile-cards tbody,
  body .erp-data-table.erp-mobile-cards tr,
  body .erp-data-table.erp-mobile-cards td {
    display: block;
    width: 100%;
  }

  body .erp-data-table.erp-mobile-cards tbody {
    padding: 10px;
    background: #f3f6fa;
  }

  body .erp-data-table.erp-mobile-cards tbody tr {
    margin-bottom: 10px;
    padding: 7px 11px;
    border: 1px solid #e0e7f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .035);
  }

  body .erp-data-table.erp-mobile-cards tbody td {
    display: grid;
    grid-template-columns: minmax(95px, 38%) 1fr;
    gap: 9px;
    padding: 8px 2px !important;
    border-bottom: 1px solid #edf1f6 !important;
    background: #fff !important;
    text-align: right !important;
    white-space: normal;
  }

  body .erp-data-table.erp-mobile-cards tbody td:before {
    content: attr(data-label);
    color: #7a8799;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-align: left;
    text-transform: uppercase;
  }

  body .erp-data-table.erp-mobile-cards tbody td:last-child {
    border-bottom: 0 !important;
  }
}

@media print {

  .erp-table-toolbar,
  .erp-table-footer,
  .dataTables_wrapper .row:first-child,
  .dataTables_wrapper .row:last-child {
    display: none !important;
  }

  .erp-table-shell {
    border: 0;
    box-shadow: none;
    overflow: visible;
  }

  .erp-table-scroll {
    overflow: visible;
  }

  body .erp-data-table.table thead th,
  body .erp-data-table.table tbody td {
    padding: 4px !important;
    font-size: 9px !important;
  }
}