:root {
    --erp-table-ink: #172033;
    --erp-table-muted: #687387;
    --erp-table-border: #dfe5ec;
    --erp-table-surface: #fff;
    --erp-table-soft: #f6f8fb;
    --erp-table-accent: #176b87;
    --erp-table-accent-dark: #10566d;
}

.erp-legacy-dt-buttons,
.erp-legacy-dt-filter {
    display: none !important;
}

.erp-integrated-export-link {
    display: none !important;
}

.erp-legacy-toolbar-row {
    display: none !important;
}

.erp-table-toolbar {
    align-items: center;
    background: linear-gradient(135deg, #fff 0%, #f7fafc 100%);
    border: 1px solid var(--erp-table-border);
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    margin: 0 0 14px;
    padding: 10px;
}

.erp-table-search-wrap {
    flex: 1 1 220px;
    max-width: 360px;
    position: relative;
}

.erp-table-search-wrap > i {
    color: var(--erp-table-muted);
    inset-inline-start: 12px;
    position: absolute;
    top: 11px;
}

.erp-table-search {
    border-color: var(--erp-table-border) !important;
    border-radius: 8px !important;
    padding-inline-start: 34px !important;
}

.erp-table-tool {
    align-items: center;
    background: var(--erp-table-surface);
    border: 1px solid var(--erp-table-border);
    border-radius: 8px;
    color: var(--erp-table-ink);
    display: inline-flex;
    font-family: Cairo, sans-serif;
    font-weight: 600;
    gap: 7px;
    min-height: 36px;
    padding: 7px 12px;
    white-space: nowrap;
}

.erp-table-tool:hover,
.erp-table-tool:focus {
    background: #eef7fa;
    border-color: #a8ccd8;
    color: var(--erp-table-accent-dark);
}

.erp-table-length {
    margin: 0 !important;
}

.erp-table-length label {
    align-items: center;
    display: flex;
    gap: 6px;
    margin: 0;
    white-space: nowrap;
}

.erp-table-length select {
    border: 1px solid var(--erp-table-border);
    border-radius: 7px;
    height: 36px;
}

.erp-export-wrap {
    position: relative;
}

.erp-export-menu {
    background: #fff;
    border: 1px solid var(--erp-table-border);
    border-radius: 9px;
    box-shadow: 0 14px 32px rgba(23, 32, 51, .16);
    display: none;
    inset-inline-start: 0;
    min-width: 230px;
    padding: 6px;
    position: absolute;
    top: calc(100% + 6px);
    z-index: 1040;
}

.erp-export-menu.is-open {
    display: block;
}

.erp-export-menu button {
    background: transparent;
    border: 0;
    border-radius: 6px;
    display: block;
    padding: 9px 10px;
    text-align: start;
    width: 100%;
}

.erp-export-menu button:hover {
    background: var(--erp-table-soft);
}

.erp-filter-badge {
    background: #e7f5ed;
    border-radius: 999px;
    color: #177245;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 9px;
}

.erp-table-preferences-overlay {
    background: rgba(10, 20, 35, .4);
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity .2s ease;
    z-index: 10500;
}

.erp-table-preferences-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.erp-table-preferences-drawer {
    background: var(--erp-table-surface);
    bottom: 0;
    box-shadow: 18px 0 48px rgba(13, 31, 48, .2);
    display: flex;
    flex-direction: column;
    left: 0;
    max-width: 100%;
    position: fixed;
    top: 0;
    transform: translateX(-105%);
    transition: transform .24s ease;
    width: 440px;
    z-index: 10510;
}

.erp-table-preferences-drawer.is-open {
    transform: translateX(0);
}

.erp-table-preferences-drawer header {
    align-items: flex-start;
    border-bottom: 1px solid var(--erp-table-border);
    display: flex;
    gap: 15px;
    justify-content: space-between;
    padding: 22px;
}

.erp-table-preferences-drawer h3 {
    color: var(--erp-table-ink);
    font-family: Cairo, sans-serif;
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 4px;
}

.erp-table-preferences-drawer header p {
    color: var(--erp-table-muted);
    font-size: 13px;
    margin: 0;
}

.erp-close-drawer {
    background: var(--erp-table-soft);
    border: 0;
    border-radius: 50%;
    color: var(--erp-table-ink);
    font-size: 25px;
    height: 34px;
    line-height: 30px;
    width: 34px;
}

.erp-drawer-search {
    margin: 16px 18px 8px;
    position: relative;
}

.erp-drawer-search i {
    color: var(--erp-table-muted);
    inset-inline-start: 12px;
    position: absolute;
    top: 11px;
}

.erp-drawer-search input {
    border-color: var(--erp-table-border);
    border-radius: 8px;
    padding-inline-start: 34px;
}

.erp-reorder-note {
    background: #fff8e8;
    color: #7b5c0c;
    font-size: 12px;
    margin: 4px 18px 8px;
    padding: 8px 10px;
}

.erp-table-columns-list {
    flex: 1 1 auto;
    list-style: none;
    margin: 0;
    overflow-y: auto;
    padding: 8px 18px 16px;
}

.erp-column-item {
    align-items: center;
    background: #fff;
    border: 1px solid var(--erp-table-border);
    border-radius: 9px;
    display: grid;
    gap: 9px;
    grid-template-columns: 20px minmax(120px, 1fr) auto 92px;
    margin-bottom: 8px;
    min-height: 52px;
    padding: 8px 10px;
}

.erp-column-item:hover {
    background: #f9fbfc;
    border-color: #b9ccd4;
}

.erp-column-drag {
    color: #a4adba;
    cursor: grab;
    text-align: center;
}

.erp-reorder-disabled .erp-column-drag {
    cursor: default;
    visibility: hidden;
}

.erp-column-item > label {
    color: var(--erp-table-ink);
    font-weight: 600;
    margin: 0;
}

.erp-column-status {
    background: #f1f3f6;
    border-radius: 999px;
    color: var(--erp-table-muted);
    font-size: 11px;
    padding: 3px 7px;
}

.erp-column-status.is-visible {
    background: #e7f5ed;
    color: #177245;
}

.erp-column-width {
    align-items: center;
    display: flex;
    gap: 4px;
}

.erp-column-width span {
    color: var(--erp-table-muted);
    font-size: 10px;
}

.erp-column-width input {
    border: 1px solid var(--erp-table-border);
    border-radius: 5px;
    max-width: 58px;
    padding: 4px;
}

.erp-drawer-options {
    background: var(--erp-table-soft);
    border-top: 1px solid var(--erp-table-border);
    display: grid;
    gap: 9px;
    padding: 13px 18px;
}

.erp-drawer-options label {
    font-size: 13px;
    margin: 0;
}

.erp-table-preferences-drawer footer {
    align-items: center;
    border-top: 1px solid var(--erp-table-border);
    display: flex;
    justify-content: space-between;
    padding: 14px 18px;
}

.erp-table-preferences-drawer footer button {
    border: 1px solid var(--erp-table-border);
    border-radius: 7px;
    font-weight: 700;
    margin-inline-start: 6px;
    padding: 8px 13px;
}

.erp-drawer-save {
    background: var(--erp-table-accent);
    border-color: var(--erp-table-accent) !important;
    color: #fff;
}

.erp-drawer-cancel,
.erp-drawer-reset {
    background: #fff;
    color: var(--erp-table-ink);
}

body.erp-table-drawer-open {
    overflow: hidden;
}

.dataTables_wrapper .dataTables_scrollHead {
    position: sticky;
    top: 0;
    z-index: 4;
}

.dataTables_wrapper table.dataTable thead th {
    background: #f7f9fb;
    color: #20283a;
    font-family: Cairo, sans-serif;
    font-weight: 700;
    vertical-align: middle;
    white-space: nowrap;
}

.dataTables_wrapper table.dataTable tbody tr:hover {
    background-color: #f6fafb;
}

.dataTables_wrapper table.dataTable td {
    max-width: 340px;
    vertical-align: middle;
}

.dataTables_wrapper table.dataTable td .display_currency,
.dataTables_wrapper table.dataTable td [data-is_quantity="true"] {
    direction: ltr;
    display: inline-block;
    white-space: nowrap;
}

.dataTables_wrapper table.erp-table-compact td,
.dataTables_wrapper table.erp-table-compact th {
    padding-bottom: 5px !important;
    padding-top: 5px !important;
}

@media (max-width: 767px) {
    .erp-table-toolbar {
        align-items: stretch;
    }

    .erp-table-search-wrap {
        flex-basis: 100%;
        max-width: none;
    }

    .erp-table-tool {
        flex: 1 1 calc(50% - 8px);
        justify-content: center;
    }

    .erp-table-preferences-drawer {
        border-radius: 18px 18px 0 0;
        height: 94vh;
        left: 0;
        top: auto;
        transform: translateY(105%);
        width: 100%;
    }

    .erp-table-preferences-drawer.is-open {
        transform: translateY(0);
    }

    .erp-column-item {
        grid-template-columns: 18px minmax(105px, 1fr) auto;
    }

    .erp-column-width {
        grid-column: 2 / -1;
    }
}
