.table.dataTable {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-collapse: collapse !important;
    width: 100% !important;
}

.table.dataTable thead th,
.table.dataTable thead td {
    white-space: nowrap;
    vertical-align: middle;
}

.table.dataTable tbody td {
    vertical-align: middle;
}

.table.dataTable tbody tr {
    transition: background-color .15s ease-in-out;
}

.table.dataTable tbody tr:nth-child(even) {
    background: #fbfcfe;
}

.table.dataTable tbody tr:hover {
    background: rgba(81, 86, 190, .03);
}

.erp-dt-responsive {
    overflow-x: auto;
}

.erp-dt-shell {
    min-height: 120px;
}

.dataTables_wrapper {
    width: 100%;
    position: relative;
}

.dataTables_wrapper .erp-dt-bottom,
.erp-dt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    flex-wrap: wrap;
}

.card-body.p-0 > .dataTables_wrapper > .erp-dt-bottom,
.card-body.p-0 > .dataTables_wrapper > .erp-dt-toolbar,
.card-body.p-0 > .dataTables_wrapper > .erp-dt-lite-toolbar {
    padding-left: 1rem;
    padding-right: 1rem;
}

.erp-dt-toolbar {
    border-top: 1px solid #eef0f2;
    border-bottom: 1px solid #eef0f2;
    margin-bottom: 12px;
}

.card-body.p-0 > .table-responsive + .text-muted.small,
.card-body.p-0 > .table-responsive + .small.text-muted,
.card-body.p-0 > .dataTables_wrapper > .table-responsive + .text-muted.small,
.card-body.p-0 > .dataTables_wrapper > .table-responsive + .small.text-muted {
    display: block;
    padding: 0 1rem 1rem;
    margin-top: 0 !important;
}

.erp-dt-toolbar-left,
.erp-dt-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.erp-dt-inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin: 0;
}

.dataTables_wrapper .dataTables_length label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .875rem;
    color: #495057;
}

.dataTables_wrapper .dataTables_info {
    font-size: .875rem;
    color: #6c757d;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px !important;
    margin-left: 4px;
    border: 1px solid #dee2e6 !important;
    border-radius: .375rem;
    background: #fff !important;
    color: #495057 !important;
    text-decoration: none !important;
    cursor: pointer;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: #5156be !important;
    color: #5156be !important;
    background: #eef0ff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #5156be !important;
    border-color: #5156be !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    opacity: .55;
    cursor: default;
    background: #fff !important;
    color: #98a6ad !important;
    border-color: #dee2e6 !important;
}

.dataTables_wrapper .dataTables_processing {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 14px;
    border-radius: .5rem;
    background: rgba(255,255,255,.96);
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    z-index: 3;
}

table.fixedHeader-floating,
table.fixedHeader-locked {
    margin-top: 0 !important;
    background: #fff;
    border-collapse: separate !important;
    z-index: 1040 !important;
}

table.fixedHeader-floating {
    box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
}

table.fixedHeader-floating thead th,
table.fixedHeader-floating thead td,
table.fixedHeader-locked thead th,
table.fixedHeader-locked thead td {
    background: #fff;
}

body[data-layout-mode=dark] table.fixedHeader-floating,
body[data-layout-mode=dark] table.fixedHeader-locked {
    background: #313533;
}

body[data-layout-mode=dark] table.fixedHeader-floating thead th,
body[data-layout-mode=dark] table.fixedHeader-floating thead td,
body[data-layout-mode=dark] table.fixedHeader-locked thead th,
body[data-layout-mode=dark] table.fixedHeader-locked thead td {
    background: #313533;
    border-color: #3b403d;
    color: #ced4da;
}

.erp-dt-empty {
    display: none;
}

.erp-dt-empty.is-visible {
    display: block;
}

@media (max-width: 767.98px) {
    .dataTables_wrapper .erp-dt-bottom,
    .erp-dt-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .card-body.p-0 > .dataTables_wrapper > .erp-dt-bottom,
    .card-body.p-0 > .dataTables_wrapper > .erp-dt-toolbar,
    .card-body.p-0 > .dataTables_wrapper > .erp-dt-lite-toolbar,
    .card-body.p-0 > .table-responsive + .text-muted.small,
    .card-body.p-0 > .table-responsive + .small.text-muted,
    .card-body.p-0 > .dataTables_wrapper > .table-responsive + .text-muted.small,
    .card-body.p-0 > .dataTables_wrapper > .table-responsive + .small.text-muted {
        padding-left: .875rem;
        padding-right: .875rem;
    }

    .erp-dt-toolbar .btn {
        width: 100% !important;
    }
}

.table.dataTable thead th.sorting,
.table.dataTable thead th.sorting_asc,
.table.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 28px !important;
    cursor: pointer;
}

.table.dataTable thead th.sorting:before,
.table.dataTable thead th.sorting_asc:before,
.table.dataTable thead th.sorting_desc:before,
.table.dataTable thead th.sorting:after,
.table.dataTable thead th.sorting_asc:after,
.table.dataTable thead th.sorting_desc:after {
    position: absolute;
    right: 10px;
    font-size: 10px;
    line-height: 1;
    color: #98a6ad;
}

.table.dataTable thead th.sorting:before,
.table.dataTable thead th.sorting_asc:before,
.table.dataTable thead th.sorting_desc:before {
    content: '▲';
    top: calc(50% - 9px);
}

.table.dataTable thead th.sorting:after,
.table.dataTable thead th.sorting_asc:after,
.table.dataTable thead th.sorting_desc:after {
    content: '▼';
    top: calc(50% + 1px);
}

.table.dataTable thead th.sorting_asc:before,
.table.dataTable thead th.sorting_desc:after {
    color: #5156be;
}

/* ── Column resize handle ─────────────────────────────── */
.erp-dt-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    user-select: none;
    z-index: 5;
    background: transparent;
    transition: background .15s;
}
.erp-dt-resize-handle:hover {
    background: rgba(81, 86, 190, .25);
}
body.erp-dt-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}
body.erp-dt-resizing .erp-dt-resize-handle {
    background: rgba(81, 86, 190, .35);
}

/* ── Column reorder drag indicators ──────────────────── */
.table.dataTable thead th[draggable="true"] {
    cursor: grab;
}
.table.erp-dt-lite thead th[draggable="true"] {
    cursor: grab;
}
.table.dataTable thead th[draggable="true"]:active {
    cursor: grabbing;
}
.table.erp-dt-lite thead th[draggable="true"]:active {
    cursor: grabbing;
}
.erp-dt-col-dragging {
    opacity: .45;
}
.erp-dt-col-drop-before {
    border-left: 2px solid #5156be !important;
    background: rgba(81, 86, 190, .06) !important;
}
.erp-dt-col-drop-after {
    border-right: 2px solid #5156be !important;
    background: rgba(81, 86, 190, .06) !important;
}

/* ================================================================
   DARK MODE — erp-datatables overrides
   ================================================================ */

body[data-layout-mode=dark] .table.dataTable tbody tr:nth-child(even) {
    background: rgba(255,255,255,.04) !important;
}

body[data-layout-mode=dark] .table.dataTable tbody tr:nth-child(odd) {
    background: transparent !important;
}

body[data-layout-mode=dark] .erp-dt-toolbar {
    border-top-color: #34414f !important;
    border-bottom-color: #34414f !important;
}

body[data-layout-mode=dark] .dataTables_wrapper .dataTables_length label,
body[data-layout-mode=dark] .dataTables_wrapper .dataTables_info {
    color: #a6b4c6 !important;
}

body[data-layout-mode=dark] .dataTables_wrapper .dataTables_paginate .paginate_button {
    background: #1c252e !important;
    border-color: #34414f !important;
    color: #d7e1ec !important;
}

body[data-layout-mode=dark] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(99,102,241,.18) !important;
    border-color: #818cf8 !important;
    color: #dce6ff !important;
}

body[data-layout-mode=dark] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
body[data-layout-mode=dark] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #4f46e5 !important;
    border-color: #6366f1 !important;
    color: #fff !important;
}

body[data-layout-mode=dark] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
body[data-layout-mode=dark] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: #181f28 !important;
    border-color: #2a3644 !important;
    color: #56667a !important;
}

body[data-layout-mode=dark] .dataTables_wrapper .dataTables_processing {
    background: rgba(24,32,42,.96) !important;
    border-color: #34414f !important;
    color: #d7e1ec !important;
    box-shadow: 0 4px 16px rgba(0,0,0,.4) !important;
}

body[data-layout-mode=dark] table.fixedHeader-floating,
body[data-layout-mode=dark] table.fixedHeader-locked {
    background: #1b232c !important;
    border-color: #34414f !important;
}

body[data-layout-mode=dark] table.fixedHeader-floating thead th,
body[data-layout-mode=dark] table.fixedHeader-floating thead td,
body[data-layout-mode=dark] table.fixedHeader-locked thead th,
body[data-layout-mode=dark] table.fixedHeader-locked thead td {
    background: #202833 !important;
    border-color: #34414f !important;
    color: #cdd8e7 !important;
}

body[data-layout-mode=dark] .table.dataTable thead th.sorting:before,
body[data-layout-mode=dark] .table.dataTable thead th.sorting_asc:before,
body[data-layout-mode=dark] .table.dataTable thead th.sorting_desc:before,
body[data-layout-mode=dark] .table.dataTable thead th.sorting:after,
body[data-layout-mode=dark] .table.dataTable thead th.sorting_asc:after,
body[data-layout-mode=dark] .table.dataTable thead th.sorting_desc:after {
    color: #56667a !important;
}

body[data-layout-mode=dark] .table.dataTable thead th.sorting_asc:before,
body[data-layout-mode=dark] .table.dataTable thead th.sorting_desc:after {
    color: #93a4ff !important;
}

body[data-layout-mode=dark] .erp-dt-col-drop-before {
    border-left-color: #818cf8 !important;
    background: rgba(99,102,241,.10) !important;
}

body[data-layout-mode=dark] .erp-dt-col-drop-after {
    border-right-color: #818cf8 !important;
    background: rgba(99,102,241,.10) !important;
}
