/**
 * Purchases & purchase returns — table layout (column alignment, scrollX head/body sync)
 */

#scrollable-container #purchase_table,
#scrollable-container #purchase_return_datatable,
#scrollable-container .dataTables_scrollHead #purchase_table,
#scrollable-container .dataTables_scrollHead #purchase_return_datatable,
#scrollable-container .dataTables_scrollBody #purchase_table,
#scrollable-container .dataTables_scrollBody #purchase_return_datatable {
    width: 100% !important;
    min-width: 72rem;
    table-layout: auto !important;
    border-collapse: collapse !important;
}

#scrollable-container #purchase_table_wrapper,
#scrollable-container #purchase_return_datatable_wrapper {
    width: 100% !important;
    max-width: 100% !important;
}

#scrollable-container #purchase_table_wrapper .dataTables_scroll,
#scrollable-container #purchase_return_datatable_wrapper .dataTables_scroll {
    width: 100% !important;
    clear: both;
}

#scrollable-container #purchase_table_wrapper .dataTables_scrollHead,
#scrollable-container #purchase_return_datatable_wrapper .dataTables_scrollHead {
    overflow: hidden !important;
}

#scrollable-container #purchase_table_wrapper .dataTables_scrollBody,
#scrollable-container #purchase_return_datatable_wrapper .dataTables_scrollBody {
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

#scrollable-container #purchase_table thead th,
#scrollable-container #purchase_table tbody td,
#scrollable-container #purchase_table tfoot td,
#scrollable-container .dataTables_scrollHead #purchase_table thead th,
#scrollable-container .dataTables_scrollBody #purchase_table tbody td,
#scrollable-container .dataTables_scrollFoot #purchase_table tfoot td {
    display: table-cell !important;
    position: static !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
}

/* Action (col 1) */
#scrollable-container #purchase_table thead th:nth-child(1),
#scrollable-container #purchase_table tbody td:nth-child(1),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(1),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(1) {
    min-width: 8.5rem !important;
    width: 8.5rem !important;
    max-width: none !important;
    white-space: nowrap !important;
    text-align: center !important;
}

/* Date */
#scrollable-container #purchase_table thead th:nth-child(2),
#scrollable-container #purchase_table tbody td:nth-child(2),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(2),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(2) {
    min-width: 10rem !important;
    white-space: nowrap !important;
}

/* Ref no */
#scrollable-container #purchase_table thead th:nth-child(3),
#scrollable-container #purchase_table tbody td:nth-child(3),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(3),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(3) {
    min-width: 9rem !important;
    white-space: nowrap !important;
}

/* Location */
#scrollable-container #purchase_table thead th:nth-child(4),
#scrollable-container #purchase_table tbody td:nth-child(4),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(4),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(4) {
    min-width: 10rem !important;
}

/* Supplier */
#scrollable-container #purchase_table thead th:nth-child(5),
#scrollable-container #purchase_table tbody td:nth-child(5),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(5),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(5) {
    min-width: 14rem !important;
    white-space: normal !important;
}

/* Status */
#scrollable-container #purchase_table thead th:nth-child(6),
#scrollable-container #purchase_table tbody td:nth-child(6),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(6),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(6) {
    min-width: 8.5rem !important;
    text-align: center !important;
    white-space: nowrap !important;
}

/* Payment status */
#scrollable-container #purchase_table thead th:nth-child(7),
#scrollable-container #purchase_table tbody td:nth-child(7),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(7),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(7) {
    min-width: 9rem !important;
    text-align: center !important;
    white-space: nowrap !important;
}

/* Grand total */
#scrollable-container #purchase_table thead th:nth-child(8),
#scrollable-container #purchase_table tbody td:nth-child(8),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(8),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(8) {
    min-width: 9rem !important;
    text-align: right !important;
    white-space: nowrap !important;
}

/* Payment due */
#scrollable-container #purchase_table thead th:nth-child(9),
#scrollable-container #purchase_table tbody td:nth-child(9),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(9),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(9) {
    min-width: 11rem !important;
    white-space: normal !important;
}

/* Custom fields */
#scrollable-container #purchase_table thead th:nth-child(10),
#scrollable-container #purchase_table tbody td:nth-child(10),
#scrollable-container #purchase_table thead th:nth-child(11),
#scrollable-container #purchase_table tbody td:nth-child(11),
#scrollable-container #purchase_table thead th:nth-child(12),
#scrollable-container #purchase_table tbody td:nth-child(12),
#scrollable-container #purchase_table thead th:nth-child(13),
#scrollable-container #purchase_table tbody td:nth-child(13),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(10),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(11),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(12),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(13),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(10),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(11),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(12),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(13) {
    min-width: 8rem !important;
}

/* Added by */
#scrollable-container #purchase_table thead th:nth-child(14),
#scrollable-container #purchase_table tbody td:nth-child(14),
#scrollable-container .dataTables_scrollHead #purchase_table thead th:nth-child(14),
#scrollable-container .dataTables_scrollBody #purchase_table tbody td:nth-child(14) {
    min-width: 8rem !important;
    white-space: nowrap !important;
}

#scrollable-container #purchase_table thead th {
    white-space: nowrap !important;
}

/* Purchase returns — mirrors purchases column layout */
#scrollable-container #purchase_return_datatable thead th,
#scrollable-container #purchase_return_datatable tbody td,
#scrollable-container #purchase_return_datatable tfoot td,
#scrollable-container .dataTables_scrollHead #purchase_return_datatable thead th,
#scrollable-container .dataTables_scrollBody #purchase_return_datatable tbody td,
#scrollable-container .dataTables_scrollFoot #purchase_return_datatable tfoot td {
    display: table-cell !important;
    position: static !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
}

#scrollable-container #purchase_return_datatable thead th:nth-child(1),
#scrollable-container #purchase_return_datatable tbody td:nth-child(1),
#scrollable-container .dataTables_scrollHead #purchase_return_datatable thead th:nth-child(1),
#scrollable-container .dataTables_scrollBody #purchase_return_datatable tbody td:nth-child(1) {
    min-width: 8.5rem !important;
    width: 8.5rem !important;
    white-space: nowrap !important;
    text-align: center !important;
}

#scrollable-container #purchase_return_datatable thead th:nth-child(2),
#scrollable-container #purchase_return_datatable tbody td:nth-child(2),
#scrollable-container .dataTables_scrollHead #purchase_return_datatable thead th:nth-child(2),
#scrollable-container .dataTables_scrollBody #purchase_return_datatable tbody td:nth-child(2) {
    min-width: 10rem !important;
    white-space: nowrap !important;
}

#scrollable-container #purchase_return_datatable thead th:nth-child(3),
#scrollable-container #purchase_return_datatable tbody td:nth-child(3),
#scrollable-container #purchase_return_datatable thead th:nth-child(4),
#scrollable-container #purchase_return_datatable tbody td:nth-child(4),
#scrollable-container .dataTables_scrollHead #purchase_return_datatable thead th:nth-child(3),
#scrollable-container .dataTables_scrollHead #purchase_return_datatable thead th:nth-child(4),
#scrollable-container .dataTables_scrollBody #purchase_return_datatable tbody td:nth-child(3),
#scrollable-container .dataTables_scrollBody #purchase_return_datatable tbody td:nth-child(4) {
    min-width: 9rem !important;
    white-space: nowrap !important;
}

#scrollable-container #purchase_return_datatable thead th:nth-child(5),
#scrollable-container #purchase_return_datatable tbody td:nth-child(5),
#scrollable-container .dataTables_scrollHead #purchase_return_datatable thead th:nth-child(5),
#scrollable-container .dataTables_scrollBody #purchase_return_datatable tbody td:nth-child(5) {
    min-width: 10rem !important;
}

#scrollable-container #purchase_return_datatable thead th:nth-child(6),
#scrollable-container #purchase_return_datatable tbody td:nth-child(6),
#scrollable-container .dataTables_scrollHead #purchase_return_datatable thead th:nth-child(6),
#scrollable-container .dataTables_scrollBody #purchase_return_datatable tbody td:nth-child(6) {
    min-width: 14rem !important;
    white-space: normal !important;
}

#scrollable-container #purchase_return_datatable thead th:nth-child(7),
#scrollable-container #purchase_return_datatable tbody td:nth-child(7),
#scrollable-container .dataTables_scrollHead #purchase_return_datatable thead th:nth-child(7),
#scrollable-container .dataTables_scrollBody #purchase_return_datatable tbody td:nth-child(7) {
    min-width: 9rem !important;
    text-align: center !important;
    white-space: nowrap !important;
}

#scrollable-container #purchase_return_datatable thead th:nth-child(8),
#scrollable-container #purchase_return_datatable tbody td:nth-child(8),
#scrollable-container .dataTables_scrollHead #purchase_return_datatable thead th:nth-child(8),
#scrollable-container .dataTables_scrollBody #purchase_return_datatable tbody td:nth-child(8) {
    min-width: 9rem !important;
    text-align: right !important;
    white-space: nowrap !important;
}

#scrollable-container #purchase_return_datatable thead th:nth-child(9),
#scrollable-container #purchase_return_datatable tbody td:nth-child(9),
#scrollable-container .dataTables_scrollHead #purchase_return_datatable thead th:nth-child(9),
#scrollable-container .dataTables_scrollBody #purchase_return_datatable tbody td:nth-child(9) {
    min-width: 11rem !important;
    white-space: normal !important;
}

#scrollable-container #purchase_return_datatable thead th {
    white-space: nowrap !important;
}
