/* Shared accounting voucher surface.
   Header follows PUVoucher; detail tables follow SAVoucher. */
.accounting-voucher-form {
    --atf-voucher-label-min: 88px;
    --atf-voucher-label-max: 112px;
    --atf-voucher-label-width: clamp(var(--atf-voucher-label-min), 8.5vw, var(--atf-voucher-label-max));
    color: var(--atf-text);
    font-size: var(--atf-control-font-size);
}

@media (min-width: 1600px) {
    .accounting-voucher-form {
        --atf-voucher-label-min: 104px;
        --atf-voucher-label-max: 132px;
    }
}

.accounting-voucher-form #FormHeader {
    border: 1px solid var(--atf-line);
    border-radius: 6px;
    overflow: hidden;
    background: var(--atf-surface);
}

.accounting-voucher-form #FormHeader > .card-header,
.accounting-voucher-form #FormFooter {
    min-height: 34px;
    border-color: var(--atf-line);
}

.general-voucher-form #FormFooter {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
}

.general-voucher-form #FormFooter > .voucher-footer-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
}

.accounting-voucher-form #FormHeader > .card-header .modal-title {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin: 0;
    font-size: calc(var(--atf-control-font-size) + 4px);
    font-weight: 600;
    line-height: 1.2;
}

.accounting-voucher-form #FormHeader > .modal-body {
    --bs-gutter-x: .5rem;
    --bs-gutter-y: .35rem;
    align-items: flex-start;
    background: var(--atf-surface);
}

.accounting-voucher-form .my-card {
    border: 1px solid var(--atf-line);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(23, 32, 51, .06) !important;
    overflow: hidden;
}

.accounting-voucher-form .my-card .card-header,
.accounting-voucher-form .my-card .card-body,
.accounting-voucher-form .my-card .card-footer {
    padding: .22rem .3rem !important;
}

/* Keep the VoucherType card header border lighter than the other card borders. */
.accounting-voucher-form #cardvc > .my-card > .card-header {
    border-width: .5px !important;
    border-style: solid !important;
    border-color: var(--atf-line) !important;
}

.accounting-voucher-form .form-row-group {
    display: grid;
    grid-template-columns: minmax(var(--atf-voucher-label-min), var(--atf-voucher-label-width)) minmax(0, 1fr);
    align-items: center;
    gap: .28rem;
    min-height: var(--atf-control-height);
    margin-bottom: .18rem;
    min-width: 0;
}

.accounting-voucher-form .form-row-group:last-child {
    margin-bottom: 0;
}

.accounting-voucher-form .form-row-group > label,
.accounting-voucher-form .form-row-group > .col-form-label {
    grid-column: 1;
    width: auto !important;
    min-width: 0;
    max-width: none !important;
    margin: 0;
    padding: 0;
    color: var(--label-font-color) !important;
    font-size: var(--atf-control-font-size) !important;
    font-weight: 600;
    line-height: 1.2;
}

.accounting-voucher-form .form-row-group > input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.accounting-voucher-form .form-row-group > select,
.accounting-voucher-form .form-row-group > textarea,
.accounting-voucher-form .form-row-group > .col,
.accounting-voucher-form .form-row-group > .select2-container,
.accounting-voucher-form .form-row-group > .input-group {
    grid-column: 2;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100% !important;
}

.accounting-voucher-form .form-row-group > .col > .select2-container {
    width: 100% !important;
}

.accounting-voucher-form .form-control,
.accounting-voucher-form .form-select,
.accounting-voucher-form .form-control-sm,
.accounting-voucher-form .form-select-sm,
.accounting-voucher-form .select2-container .select2-selection--single {
    height: var(--atf-control-height) !important;
    min-height: var(--atf-control-height) !important;
    padding-top: .16rem;
    padding-bottom: .16rem;
    border-color: var(--atf-line) !important;
    border-radius: 5px !important;
    font-size: var(--atf-control-font-size) !important;
}

.accounting-voucher-form .select2-container .select2-selection__rendered {
    line-height: calc(var(--atf-control-height) - 2px) !important;
    padding-left: .45rem !important;
    padding-right: 1.25rem !important;
}

.accounting-voucher-form .select2-container .select2-selection__arrow {
    height: calc(var(--atf-control-height) - 2px) !important;
}

.accounting-voucher-form input[readonly],
.accounting-voucher-form textarea[readonly] {
    background: #eef6ff !important;
    color: #074b8f;
}

#saReturnForm .voucher-total-header input[readonly] {
    background: #eef6ff !important;
    color: #074b8f;
}

.accounting-voucher-form #TotalPaymentAmount,
.accounting-voucher-form #TotalPaymentAmountOC {
    font-weight: 700 !important;
}

.accounting-voucher-form .detail-table-container {
    border-top: 1px solid var(--atf-line);
    background: var(--atf-surface);
}

.accounting-voucher-form .listDetail-wrapper,
.accounting-voucher-form .detail-table-container .list-table-wrapper {
    width: 100%;
    background: var(--atf-surface);
}

.accounting-detail-table,
.accounting-voucher-form .voucher-detail-table {
    table-layout: auto !important;
    width: max-content !important;
    min-width: 100% !important;
    margin-bottom: 0;
    color: var(--atf-text);
    font-size: var(--atf-detail-font-size) !important;
}

.purchase-voucher-form.is-posting-partial {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
}

.purchase-voucher-form.is-posting-partial #FormHeader {
    display: grid !important;
    grid-template-rows: auto max-content minmax(0, 1fr) auto !important;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.purchase-voucher-form.is-posting-partial .detail-table-container {
    height: 100% !important;
    min-height: 0 !important;
    align-self: stretch;
}

.purchase-voucher-form.is-posting-partial .detail-table-container .list-table-wrapper {
    height: 100% !important;
    min-height: 0 !important;
    overflow: auto !important;
}

.purchase-voucher-form.is-posting-partial .detailTable,
.purchase-voucher-form.is-posting-partial .voucher-detail-table {
    table-layout: auto !important;
    width: max-content !important;
    min-width: 100% !important;
}

/* On the tax-invoice posting workspace, STT is only an ordinal.  Keep its
   usable minimum deliberately small so the user can reserve room for data. */
.purchase-voucher-form.is-posting-partial #detailTable .col-stt {
    width: 28px;
    min-width: 18px;
    max-width: none;
    padding-left: 1px !important;
    padding-right: 1px !important;
}

.purchase-voucher-form.is-posting-partial #detailTable .col-stt input {
    min-width: 0;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.purchase-voucher-form #detailTable .col-inward {
    width: 28px;
    min-width: 24px;
    text-align: center;
}

.purchase-voucher-form #detailTable .col-inward .is-inward {
    appearance: auto !important;
    -webkit-appearance: checkbox !important;
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    height: 16px !important;
    min-height: 16px !important;
    border: 1px solid var(--bs-border-color, #dee2e6) !important;
    border-radius: 0.25em !important;
    background-color: #fff !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0;
    vertical-align: middle;
    accent-color: var(--bs-primary, #0d6efd);
}

.purchase-voucher-form[data-show-oc="false"] .oc-field {
    display: none !important;
}

.purchase-voucher-form #cardtt .oc-header-panel.d-none + .card-body {
    /* Keep the VND totals panel the same width as one panel in foreign-currency mode. */
    flex: 0 0 calc(50% - .25rem);
    max-width: calc(50% - .25rem);
    margin-left: auto !important;
    margin-right: 0 !important;
}

.sales-voucher-form #cardtt .oc-header-panel.d-none + .card-body,
.sales-goods-voucher-form #cardtt .oc-header-panel.d-none + .card-body {
    /* With VND as the main currency, keep the VND totals in the right half
       that the panel occupies when foreign-currency values are visible. */
    flex: 0 0 calc(50% - .25rem);
    max-width: calc(50% - .25rem);
    margin-left: auto !important;
    margin-right: 0 !important;
}

.sales-service-form #cardtt .oc-header-panel.d-none + .card-body {
    flex: 1 1 100%;
    max-width: 100%;
}

.accounting-detail-table th,
.accounting-detail-table td,
.accounting-voucher-form .voucher-detail-table th,
.accounting-voucher-form .voucher-detail-table td {
    height: var(--atf-voucher-detail-cell-height);
    padding: 1px 2px !important;
    vertical-align: middle;
    white-space: nowrap;
    border-color: var(--atf-line) !important;
}

.accounting-detail-table thead th,
.accounting-voucher-form .voucher-detail-table thead th {
    min-width: 70px;
    height: var(--atf-detail-head-height);
    color: #16324f;
    background: #dceefb !important;
    border-color: var(--atf-line-strong) !important;
    font-weight: 600;
    text-align: center;
}

.accounting-detail-table tbody tr:hover > td,
.accounting-voucher-form .voucher-detail-table tbody tr:hover > td {
    color: var(--atf-primary-dark);
    background: #f0f7fd;
}

.accounting-detail-table .no-border,
.accounting-detail-table input,
.accounting-detail-table select,
.accounting-detail-table .form-control,
.accounting-detail-table .form-select,
.accounting-detail-table .select2-container,
.accounting-voucher-form .voucher-detail-table .no-border,
.accounting-voucher-form .voucher-detail-table input,
.accounting-voucher-form .voucher-detail-table select,
.accounting-voucher-form .voucher-detail-table .form-control,
.accounting-voucher-form .voucher-detail-table .form-select,
.accounting-voucher-form .voucher-detail-table .select2-container {
    height: var(--atf-voucher-detail-cell-height) !important;
    min-height: var(--atf-voucher-detail-cell-height) !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent;
    font-size: var(--atf-detail-font-size) !important;
    line-height: calc(var(--atf-voucher-detail-cell-height) - 2px) !important;
}

.accounting-detail-table .select2-container .select2-selection--single,
.accounting-voucher-form .voucher-detail-table .select2-container .select2-selection--single {
    height: var(--atf-voucher-detail-cell-height) !important;
    min-height: var(--atf-voucher-detail-cell-height) !important;
    border: 0 !important;
    background: transparent;
}

.accounting-detail-table .select2-container .select2-selection__rendered,
.accounting-voucher-form .voucher-detail-table .select2-container .select2-selection__rendered {
    line-height: calc(var(--atf-voucher-detail-cell-height) - 2px) !important;
    padding-left: 2px !important;
    padding-right: 12px !important;
}

.accounting-detail-table .select2-container .select2-selection__arrow,
.accounting-voucher-form .voucher-detail-table .select2-container .select2-selection__arrow {
    height: calc(var(--atf-voucher-detail-cell-height) - 2px) !important;
}

/* INT: mã tài khoản là dữ liệu ngắn; để rộng vừa đủ và vẫn cho phép kéo rộng. */
.inventory-voucher-form .detailTable .int-account-column,
.inventory-voucher-form .detailTable .int-account-cell {
    width: auto !important;
    min-width: 52px !important;
    max-width: none !important;
}
