/* ===== BTXH MODERN THEME ===== */

.btxh-header {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f3ff 60%, #f0fdf4 100%);
    border-bottom: 1px solid #dbeafe;
    padding-top: 60px;
    padding-bottom: 30px;
    margin-bottom: 20px;
}

.btxh-search-box {
    align-items: end;
    gap: 12px;
    margin-bottom: 20px;
}

.btxh-search-box .search-group {
    min-width: 180px;
}

.btxh-search-box .search-group .form-select {
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, transparent 50%, #8aa8bd 50%),
        linear-gradient(135deg, #8aa8bd 50%, transparent 50%);
    background-position:
        calc(100% - 20px) 50%,
        calc(100% - 14px) 50%;
    background-repeat: no-repeat;
    background-size: 7px 7px, 7px 7px;
    border: 1px solid rgba(15, 23, 42, .15);
    border-radius: 7px;
    box-shadow: 0 1px 1px rgba(50, 50, 50, .10);
    color: #6f93ad;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    min-height: 44px;
    outline: none;
    padding: 10px 42px 10px 12px;
    position: relative;
    text-overflow: ellipsis;
    transition: border-color .2s ease, box-shadow .2s ease, color .2s ease, transform .2s ease;
    white-space: nowrap;
}

.btxh-search-box .search-group .form-select option {
    background-color: #ffffff;
    border-bottom: 1px solid #e6e8ea;
    color: #6f93ad;
    font-weight: 500;
    min-height: 38px;
    padding: 10px;
}

.btxh-search-box .search-group .form-select option:checked {
    background-color: #f3f8f8;
    color: #4f7f9e;
}

.btxh-search-box .search-group .form-select:hover {
    border-color: rgba(112, 143, 166, .42);
    box-shadow: 0 5px 14px rgba(50, 50, 50, .12);
    color: #4f7f9e;
    transform: translateY(-1px);
}

.btxh-search-box .search-group .form-select:focus {
    border-color: rgba(112, 143, 166, .55);
    box-shadow: 0 0 0 3px rgba(138, 168, 189, .18), 0 5px 14px rgba(50, 50, 50, .12);
    color: #4f7f9e;
}

.btxh-search-box .search-group .form-select.is-open {
    animation: btxhSelectOpen .22s ease;
    background-image:
        linear-gradient(225deg, transparent 50%, #8aa8bd 50%),
        linear-gradient(315deg, #8aa8bd 50%, transparent 50%);
    box-shadow: 0 0 5px rgba(15, 23, 42, .12), 0 5px 14px rgba(50, 50, 50, .12);
}

.btxh-search-box .search-group .form-select.is-picked {
    animation: btxhSelectPicked .38s ease;
}

.btxh-search-box .search-group {
    position: relative;
}

.btxh-search-box .search-group .form-select.btxh-native-select {
    height: 1px;
    left: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 100%;
    width: 1px;
}

.btxh-select-menu {
    position: relative;
    width: 100%;
    z-index: 12;
}

.btxh-select-menu.active {
    z-index: 30;
}

.btxh-select-btn {
    align-items: center;
    background: linear-gradient(135deg, #ffffff 0%, #f5f7ff 58%, #eef2ff 100%);
    border: 1px solid rgba(80, 108, 215, .20);
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(80, 108, 215, .10);
    color: #263b88;
    cursor: pointer;
    display: flex;
    font-size: 14px;
    font-weight: 700;
    gap: 12px;
    justify-content: space-between;
    min-height: 46px;
    padding: 11px 14px 11px 16px;
    text-align: left;
    transition: border-color .2s ease, box-shadow .2s ease, color .2s ease, transform .2s ease;
    width: 100%;
}

.btxh-select-btn:hover,
.btxh-select-menu.active .btxh-select-btn {
    background: linear-gradient(135deg, #fbfcff 0%, #eef2ff 56%, #e8edff 100%);
    border-color: rgba(80, 108, 215, .42);
    box-shadow: 0 6px 18px rgba(80, 108, 215, .16);
    color: #263b88;
    transform: translateY(-1px);
}

.btxh-select-btn:focus-visible {
    border-color: rgba(80, 108, 215, .58);
    box-shadow: 0 0 0 3px rgba(80, 108, 215, .18), 0 6px 18px rgba(80, 108, 215, .14);
    outline: 0;
}

.btxh-select-text {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btxh-select-chevron {
    align-items: center;
    background: #eef2ff;
    border-radius: 8px;
    color: #506cd7;
    display: inline-flex;
    flex: 0 0 28px;
    font-size: 13px;
    height: 28px;
    justify-content: center;
    transition: transform .25s ease, background-color .2s ease, color .2s ease;
    width: 28px;
}

.btxh-select-menu.active .btxh-select-chevron {
    background: #dfe6ff;
    color: #3f55c1;
    transform: rotate(-180deg);
}

.btxh-select-options {
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
    border: 1px solid rgba(80, 108, 215, .20);
    border-radius: 8px;
    box-shadow: 0 14px 35px rgba(15, 23, 42, .14);
    display: none;
    left: 0;
    list-style: none;
    margin: 10px 0 0;
    max-height: 260px;
    overflow-y: auto;
    padding: 8px;
    position: absolute;
    right: 0;
    scrollbar-color: #a8b6f0 #f8faff;
    scrollbar-width: thin;
    top: 100%;
}

.btxh-select-menu.active .btxh-select-options {
    display: block;
}

.btxh-select-options::-webkit-scrollbar {
    width: 7px;
}

.btxh-select-options::-webkit-scrollbar-track {
    background: #f8faff;
}

.btxh-select-options::-webkit-scrollbar-thumb {
    background: #a8b6f0;
    border-radius: 999px;
}

.btxh-select-option {
    align-items: center;
    background: #fff;
    border: 0;
    border-radius: 8px;
    color: #334155;
    cursor: pointer;
    display: flex;
    font-size: 14px;
    font-weight: 600;
    gap: 10px;
    min-height: 44px;
    padding: 9px 10px;
    text-align: left;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
    width: 100%;
}

.btxh-select-option:hover,
.btxh-select-option:focus-visible {
    background: #f1f4ff;
    color: #3249b8;
    outline: 0;
}

.btxh-select-option.is-selected {
    background: linear-gradient(135deg, #eef2ff 0%, #e4eaff 100%);
    color: #263b88;
}

.btxh-select-option.is-selected::before {
    color: #506cd7;
    content: "\f00c";
    flex: 0 0 16px;
    font-family: "Font Awesome 5 Free", "FontAwesome";
    font-size: 12px;
    font-weight: 900;
}

.btxh-select-option:not(.is-selected)::before {
    background: #c8d2ff;
    border-radius: 50%;
    content: "";
    flex: 0 0 7px;
    height: 7px;
    margin-left: 4px;
    margin-right: 5px;
    width: 7px;
}

.btxh-select-option span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes btxhSelectOpen {
    0% {
        filter: brightness(1);
        transform: translateY(0);
    }
    55% {
        filter: brightness(1.03);
        transform: translateY(-1px);
    }
    100% {
        filter: brightness(1);
        transform: translateY(0);
    }
}

@keyframes btxhSelectPicked {
    0% {
        background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
        filter: brightness(1);
        transform: translateY(-1px) scale(1);
    }
    45% {
        filter: brightness(1.03);
        transform: translateY(-1px) scale(1.006);
    }
    100% {
        background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
        filter: brightness(1);
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .btxh-search-box .search-group .form-select,
    .btxh-search-box .search-group .form-select.is-open,
    .btxh-search-box .search-group .form-select.is-picked {
        animation: none;
        transition: border-color .01s linear, box-shadow .01s linear;
        transform: none;
    }
}

.btxh-search-action {
    display: flex;
    flex: 0 0 auto;
    padding-left: 1rem;
}

.btxh-search-action .btn-search-custom {
    align-items: center;
    background: linear-gradient(135deg, #506cd7 0%, #4158c5 55%, #3446a8 100%);
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 8px 18px rgba(80, 108, 215, .24);
    color: #fff;
    display: inline-flex;
    gap: 8px;
    isolation: isolate;
    min-height: 46px;
    overflow: hidden;
    position: relative;
    transition: transform .22s ease, box-shadow .22s ease, background-position .22s ease, filter .22s ease;
    white-space: nowrap;
}

.btxh-search-action .btn-search-custom::before {
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, .28) 42%, transparent 72%);
    content: "";
    inset: -30% auto -30% -70%;
    position: absolute;
    transform: skewX(-18deg);
    transition: left .48s ease;
    width: 58%;
    z-index: 0;
}

.btxh-search-action .btn-search-custom::after {
    background: radial-gradient(circle, rgba(255, 255, 255, .22) 0%, transparent 62%);
    content: "";
    height: 84px;
    opacity: 0;
    position: absolute;
    right: -28px;
    top: -34px;
    transform: scale(.65);
    transition: opacity .22s ease, transform .22s ease;
    width: 84px;
    z-index: 0;
}

.btxh-search-action .btn-search-custom:hover,
.btxh-search-action .btn-search-custom:focus-visible {
    background: linear-gradient(135deg, #5b74df 0%, #506cd7 48%, #3346b5 100%);
    box-shadow: 0 12px 26px rgba(80, 108, 215, .38), 0 0 0 4px rgba(80, 108, 215, .12);
    color: #fff;
    filter: saturate(1.08);
    transform: translateY(-3px) scale(1.015);
}

.btxh-search-action .btn-search-custom:hover::before,
.btxh-search-action .btn-search-custom:focus-visible::before {
    left: 125%;
}

.btxh-search-action .btn-search-custom:hover::after,
.btxh-search-action .btn-search-custom:focus-visible::after {
    opacity: 1;
    transform: scale(1);
}

.btxh-search-action .btn-search-custom:focus-visible {
    outline: 0;
}

.btxh-search-action .btn-search-custom:active {
    box-shadow: 0 7px 16px rgba(80, 108, 215, .30);
    transform: translateY(-1px) scale(.99);
}

.btxh-search-action .btn-search-custom:disabled {
    box-shadow: 0 6px 14px rgba(80, 108, 215, .18);
    cursor: wait;
    filter: saturate(.86);
    opacity: .82;
    transform: none;
}

.btxh-search-action .btn-search-custom i {
    position: relative;
    transition: transform .22s ease;
    z-index: 1;
}

.btxh-search-action .btn-search-custom:hover i,
.btxh-search-action .btn-search-custom:focus-visible i {
    transform: scale(1.12);
}

@media (prefers-reduced-motion: reduce) {
    .btxh-search-action .btn-search-custom,
    .btxh-search-action .btn-search-custom::before,
    .btxh-search-action .btn-search-custom::after,
    .btxh-search-action .btn-search-custom i {
        transition: border-color .01s linear, box-shadow .01s linear, filter .01s linear;
        transform: none;
    }
}

.btxh-insight-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 auto 28px;
}

.btxh-insight-card {
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    border-top: 3px solid #3b82f6;
    box-shadow: 0 4px 14px rgba(37, 99, 235, .07);
    display: flex;
    gap: 14px;
    min-height: 76px;
    padding: 14px 18px;
    transition: box-shadow .2s ease, transform .2s ease;
}

.btxh-insight-card:hover {
    box-shadow: 0 8px 26px rgba(37, 99, 235, .14);
    transform: translateY(-2px);
}

.btxh-insight-card:nth-child(2) { border-top-color: #10b981; }
.btxh-insight-card:nth-child(3) { border-top-color: #f59e0b; }

.btxh-insight-icon {
    align-items: center;
    background: #dbeafe;
    border-radius: 10px;
    color: #2563eb;
    display: flex;
    flex: 0 0 44px;
    font-size: 18px;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.btxh-insight-label {
    color: #64748b;
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .5px;
    line-height: 1.25;
    text-transform: uppercase;
}

.btxh-insight-value {
    color: #1e293b;
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.4;
    margin-top: 3px;
}

.btxh-result-toolbar {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin: 0 0 16px;
    min-height: 38px;
}

.btxh-result-hint {
    align-items: center;
    color: #64748b;
    display: inline-flex;
    font-size: 14px;
    gap: 8px;
}

.btxh-result-count {
    align-items: center;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 999px;
    color: #1d4ed8;
    display: none;
    font-size: 13px;
    font-weight: 800;
    gap: 6px;
    padding: 6px 14px;
    white-space: nowrap;
}

/* Report Wrapper Card */
.btxh-report-wrapper {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    border-top: 4px solid #3b82f6;
    box-shadow: 0 4px 20px rgba(15, 23, 42, .07);
    margin-bottom: 24px;
    overflow: hidden;
}

/* Per-section accent colors */
.btxh-report-wrapper.btxh-accent-blue    { border-top-color: #3b82f6; }
.btxh-report-wrapper.btxh-accent-indigo  { border-top-color: #6366f1; }
.btxh-report-wrapper.btxh-accent-teal    { border-top-color: #14b8a6; }
.btxh-report-wrapper.btxh-accent-emerald { border-top-color: #10b981; }
.btxh-report-wrapper.btxh-accent-amber   { border-top-color: #f59e0b; }
.btxh-report-wrapper.btxh-accent-rose    { border-top-color: #f43f5e; }

.btxh-report-header {
    align-items: center;
    background: #f8faff;
    border-bottom: 1px solid #e8f0f9;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 15px 20px;
}

.btxh-report-wrapper.btxh-accent-indigo  .btxh-report-header { background: #f5f3ff; border-bottom-color: #ede9fe; }
.btxh-report-wrapper.btxh-accent-teal    .btxh-report-header { background: #f0fdfa; border-bottom-color: #ccfbf1; }
.btxh-report-wrapper.btxh-accent-emerald .btxh-report-header { background: #f0fdf4; border-bottom-color: #bbf7d0; }
.btxh-report-wrapper.btxh-accent-amber   .btxh-report-header { background: #fffbeb; border-bottom-color: #fde68a; }
.btxh-report-wrapper.btxh-accent-rose    .btxh-report-header { background: #fff1f2; border-bottom-color: #fecdd3; }

.btxh-section-title {
    align-items: center;
    color: #1e3a8a;
    display: flex;
    font-size: 1rem;
    font-weight: 700;
    gap: 10px;
    line-height: 1.35;
    margin: 0;
}

.btxh-section-title::before {
    background: linear-gradient(180deg, #3b82f6, #6366f1);
    border-radius: 999px;
    content: "";
    display: inline-block;
    flex: 0 0 auto;
    height: 20px;
    width: 4px;
}

.btxh-report-wrapper.btxh-accent-teal    .btxh-section-title { color: #0f766e; }
.btxh-report-wrapper.btxh-accent-teal    .btxh-section-title::before { background: linear-gradient(180deg, #14b8a6, #06b6d4); }
.btxh-report-wrapper.btxh-accent-emerald .btxh-section-title { color: #166534; }
.btxh-report-wrapper.btxh-accent-emerald .btxh-section-title::before { background: linear-gradient(180deg, #10b981, #16a34a); }
.btxh-report-wrapper.btxh-accent-amber   .btxh-section-title { color: #92400e; }
.btxh-report-wrapper.btxh-accent-amber   .btxh-section-title::before { background: linear-gradient(180deg, #f59e0b, #ef4444); }
.btxh-report-wrapper.btxh-accent-rose    .btxh-section-title { color: #9f1239; }
.btxh-report-wrapper.btxh-accent-rose    .btxh-section-title::before { background: linear-gradient(180deg, #f43f5e, #ec4899); }

.btxh-section-subtitle {
    color: #64748b;
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    margin-top: 4px;
}

.btxh-report-badge {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 999px;
    color: #1d4ed8;
    flex: 0 0 auto;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .3px;
    padding: 5px 13px;
    white-space: nowrap;
}

.btxh-report-wrapper.btxh-accent-indigo  .btxh-report-badge { background: #ede9fe; border-color: #c4b5fd; color: #4338ca; }
.btxh-report-wrapper.btxh-accent-teal    .btxh-report-badge { background: #ccfbf1; border-color: #5eead4; color: #0f766e; }
.btxh-report-wrapper.btxh-accent-emerald .btxh-report-badge { background: #dcfce7; border-color: #6ee7b7; color: #15803d; }
.btxh-report-wrapper.btxh-accent-amber   .btxh-report-badge { background: #fef3c7; border-color: #fcd34d; color: #b45309; }
.btxh-report-wrapper.btxh-accent-rose    .btxh-report-badge { background: #ffe4e6; border-color: #fda4af; color: #be123c; }

/* Table Wrapper */
.btxh-table-wrapper {
    background: #fff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px 20px;
    width: 100%;
}

/* === Table: display resets === */
#tblThBtxh thead,
#tblChiTietBtxh thead,
#tblChiTietHtxh thead,
#tblDoiTuongCoso thead,
#tblThTreEm thead,
#tblChiTietTreEm thead { display: table-header-group; }

#tblThBtxh tbody,
#tblChiTietBtxh tbody,
#tblChiTietHtxh tbody,
#tblDoiTuongCoso tbody,
#tblThTreEm tbody,
#tblChiTietTreEm tbody { display: table-row-group; }

#tblThBtxh tbody tr,
#tblChiTietBtxh tbody tr,
#tblChiTietHtxh tbody tr,
#tblDoiTuongCoso tbody tr,
#tblThTreEm tbody tr,
#tblChiTietTreEm tbody tr {
    display: table-row;
    height: 50px;
    margin-bottom: 0;
    max-height: 50px;
}

/* === Table BASE === */
.btxh-table-wrapper table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 0 !important;
    min-width: 960px;
    width: 100% !important;
}

.btxh-table-wrapper table.dataTable.no-footer { border-bottom: 0 !important; }

/* === Thead === */
.btxh-table-wrapper table.dataTable thead th {
    background: #f5f3ff !important;
    border-bottom: 2px solid #bfdbfe !important;
    border-left: 1px solid #e4edfb !important;
    border-right: 0 !important;
    border-top: 0 !important;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .2px;
    line-height: 1.3;
    min-width: 100px;
    padding: 10px 9px !important;
    position: sticky;
    text-align: center;
    top: 0;
    vertical-align: middle;
    white-space: normal;
    word-break: normal;
    z-index: 5;
}

/* Group header row styling */
.btxh-table-wrapper table.dataTable thead tr.btxh-thead-group th {
    background: #f5f3ff !important;
    border-bottom: 1px solid #93c5fd !important;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .4px;
    padding: 7px 8px !important;
    text-transform: uppercase;
}

/* === Tbody === */
.btxh-table-wrapper table.dataTable tbody td {
    border-bottom: 1px solid #f1f5f9 !important;
    border-left: 1px solid #f8fafc !important;
    border-right: 0 !important;
    border-top: 0 !important;
    box-sizing: border-box;
    color: #334155;
    display: table-cell;
    font-size: 13px;
    height: 50px;
    line-height: 1.4;
    max-height: 50px;
    overflow: hidden;
    padding: 8px 10px !important;
    text-align: center;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
    width: auto;
}

/* === Striping === */
.btxh-table-wrapper table.dataTable.stripe tbody tr.odd,
.btxh-table-wrapper table.dataTable.display tbody tr.odd,
.btxh-table-wrapper table.dataTable tbody tr:nth-child(odd)  { background-color: #fafcff !important; }
.btxh-table-wrapper table.dataTable tbody tr:nth-child(even) { background-color: #ffffff !important; }

.btxh-table-wrapper table.dataTable tbody tr:hover {
    background: #eff6ff !important;
    transition: background .1s ease;
}

.btxh-table-wrapper table.dataTable tbody tr:hover td { color: #1e3a8a; }

/* === Column helpers === */
.btxh-table-wrapper td.btxh-col-text,
.btxh-table-wrapper th.btxh-col-text,
.btxh-table-wrapper td.btxh-col-place,
.btxh-table-wrapper th.btxh-col-place { text-align: left !important; }

.btxh-table-wrapper td.btxh-col-text,
.btxh-table-wrapper td.btxh-col-place {
    color: #1e293b;
    font-weight: 600;
    min-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btxh-table-wrapper td.btxh-col-note {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    min-width: 160px;
    overflow: hidden;
    text-align: left !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btxh-table-wrapper th.btxh-col-stt,
.btxh-table-wrapper td.btxh-col-stt  { min-width: 48px; width: 48px; }

.btxh-table-wrapper th.btxh-col-order,
.btxh-table-wrapper td.btxh-col-order { min-width: 72px; width: 72px; }

.btxh-table-wrapper th.btxh-col-money,
.btxh-table-wrapper td.btxh-col-money { min-width: 130px; }

.btxh-table-wrapper th.btxh-col-wide,
.btxh-table-wrapper td.btxh-col-wide  { min-width: 140px; }

.btxh-table-wrapper th.btxh-col-compact,
.btxh-table-wrapper td.btxh-col-compact { min-width: 90px; }

/* DataTables scrollX clones the header inside scrollBody to calculate widths.
   Collapse that clone so it cannot appear as a blank row under the real header. */
.btxh-table-wrapper .dataTables_scrollBody thead,
.btxh-table-wrapper .dataTables_scrollBody thead tr,
.btxh-table-wrapper .dataTables_scrollBody thead th,
.btxh-table-wrapper .dataTables_scrollBody thead td {
    border: 0 !important;
    font-size: 0 !important;
    height: 0 !important;
    line-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    padding-bottom: 0 !important;
    padding-top: 0 !important;
    visibility: hidden !important;
}

.btxh-table-wrapper .dataTables_scrollBody thead tr {
    visibility: collapse !important;
}

.btxh-table-wrapper .dataTables_scrollBody thead th::before,
.btxh-table-wrapper .dataTables_scrollBody thead th::after,
.btxh-table-wrapper .dataTables_scrollBody thead td::before,
.btxh-table-wrapper .dataTables_scrollBody thead td::after {
    display: none !important;
}

/* === Scroll container === */
.btxh-table-wrapper .dataTables_scroll {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-sizing: border-box;
    overflow: hidden;
    width: 100%;
}

.btxh-table-wrapper .dataTables_scrollHead {
    background: #f5f3ff;
    border-bottom: 1px solid #bfdbfe !important;
    position: sticky !important;
    top: 0;
    z-index: 7;
}

.btxh-table-wrapper .dataTables_scrollBody {
    border-bottom: 0 !important;
    scrollbar-color: #93c5fd #f0f7ff;
    scrollbar-width: thin;
}

.btxh-table-wrapper .dataTables_scrollBody::-webkit-scrollbar { height: 7px; width: 7px; }
.btxh-table-wrapper .dataTables_scrollBody::-webkit-scrollbar-track { background: #f0f7ff; }
.btxh-table-wrapper .dataTables_scrollBody::-webkit-scrollbar-thumb { background: #93c5fd; border-radius: 999px; }

/* Responsive expand control */
.btxh-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
.btxh-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
    padding-left: 44px !important;
    position: relative;
    vertical-align: middle !important;
}

.btxh-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
.btxh-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    align-items: center;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 50%;
    box-shadow: none;
    color: #2563eb;
    content: "+";
    display: flex;
    font-family: Arial, sans-serif;
    font-size: 16px;
    font-weight: 700;
    height: 24px;
    justify-content: center;
    left: 10px;
    line-height: 1;
    margin: 0;
    text-indent: 0;
    top: 50% !important;
    transform: translateY(-50%);
    width: 24px;
}

.btxh-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before,
.btxh-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #fff;
    content: "−";
}

.btxh-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
.btxh-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
    padding-left: 10px !important;
}

.btxh-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
.btxh-table-wrapper table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    display: none !important;
}

.btxh-table-wrapper .dtr-details { width: 100%; }

.btxh-table-wrapper .dtr-details > li {
    border-bottom: 1px solid #f1f5f9 !important;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 8px 0 !important;
}

/* Empty / loading states */
.btxh-empty-msg {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    color: #64748b;
    padding: 36px;
    text-align: center;
}

.search-label {
    color: #1e3a8a;
    font-size: 13.5px;
    font-weight: 700;
}

.btxh-loading-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
}

/* === DataTable controls === */
.btxh-table-wrapper .dataTables_wrapper { color: #334155; width: 100%; }

.btxh-table-wrapper .dataTables_wrapper .row { align-items: center; margin: 0 0 10px; }

.btxh-table-wrapper .dataTables_wrapper > .row:not(.btxh-dt-controls):not(.btxh-dt-footer) > .col-sm-12 {
    padding-left: 0;
    padding-right: 0;
}

.btxh-table-wrapper .btxh-dt-controls,
.btxh-table-wrapper .btxh-dt-footer {
    align-items: center !important;
    background: #f8fafd;
    border: 1px solid #e2ecf5;
    border-radius: 10px;
    margin: 0 0 14px !important;
    padding: 10px 14px;
}

.btxh-table-wrapper .btxh-dt-footer { margin: 14px 0 0 !important; }

.btxh-table-wrapper .dataTables_filter input,
.btxh-table-wrapper .dataTables_length select {
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #0f172a;
    font-size: 13px;
    height: 36px;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.btxh-table-wrapper .dataTables_filter,
.btxh-table-wrapper .dataTables_length {
    align-items: center;
    display: flex;
    min-height: 42px;
}

.btxh-table-wrapper .dataTables_filter {
    justify-content: flex-end;
}

.btxh-table-wrapper .dataTables_filter input:focus,
.btxh-table-wrapper .dataTables_length select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
    outline: 0;
}

.btxh-table-wrapper .dataTables_filter input  { min-width: 220px; padding: 6px 12px; }
.btxh-table-wrapper .dataTables_length select { min-width: 76px; padding: 6px 28px 6px 10px; }

.btxh-table-wrapper .dataTables_filter label,
.btxh-table-wrapper .dataTables_length label {
    align-items: center;
    color: #64748b;
    display: inline-flex;
    font-size: 13px;
    font-weight: 700;
    gap: 8px;
    line-height: 1;
    margin-bottom: 0;
}

.btxh-table-wrapper .dataTables_info {
    color: #64748b;
    font-size: 12.5px;
    font-weight: 600;
    padding-top: 0 !important;
}

/* === Pagination === */
.btxh-table-wrapper .dataTables_paginate { padding-top: 0 !important; }
.btxh-table-wrapper .pagination { gap: 4px; justify-content: flex-end; margin: 0; }

.btxh-table-wrapper .page-link {
    border: 1px solid #e2e8f0;
    border-radius: 8px !important;
    color: #3b82f6;
    font-size: 13px;
    font-weight: 600;
    min-width: 34px;
    padding: 5px 8px;
    text-align: center;
    transition: all .15s ease;
}

.btxh-table-wrapper .page-link:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }

.btxh-table-wrapper .page-item.active .page-link {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(59, 130, 246, .28);
    color: #fff;
}

.btxh-table-wrapper .page-item.disabled .page-link { background: #f8fafc; border-color: #e2e8f0; color: #cbd5e1; }

/* === Table min-widths === */
.btxh-table-wrapper table.dataTable { min-width: 980px; }
.btxh-table-wrapper #tblThBtxh, .btxh-table-wrapper #tblThTreEm { min-width: 780px; }
.btxh-table-wrapper #tblDoiTuongCoso, .btxh-table-wrapper #tblChiTietHtxh { min-width: 1120px; }
.btxh-table-wrapper #tblChiTietBtxh { min-width: 2840px; }
.btxh-table-wrapper #tblChiTietTreEm { min-width: 2140px; }

/* === Number cells === */
.btxh-table-wrapper tbody td.btxh-col-number,
.btxh-table-wrapper tbody td.btxh-col-money {
    font-variant-numeric: tabular-nums;
    text-align: right !important;
}

.btxh-table-wrapper tbody td.btxh-col-stt,
.btxh-table-wrapper tbody td.btxh-col-order {
    color: #94a3b8;
    font-weight: 700;
    text-align: center !important;
}

.btxh-table-wrapper .btxh-number {
    color: #0369a1;
    display: inline-block;
    font-weight: 700;
    min-width: 38px;
}

.btxh-table-wrapper td.btxh-col-money .btxh-number { color: #047857; }
.btxh-table-wrapper .btxh-empty { color: #cbd5e1; font-weight: 600; }

.btxh-table-wrapper td.btxh-col-text,
.btxh-table-wrapper td.btxh-col-place { color: #1e293b; font-weight: 600; max-width: 300px; }

.btxh-table-wrapper td.btxh-col-note { color: #64748b; max-width: 260px; }

/* === Highlight row (totals) === */
.btxh-table-wrapper tr.btxh-highlight-row td {
    background: linear-gradient(90deg, #fef9ee, #fffef5) !important;
    border-bottom: 1px solid #fde68a !important;
    color: #1c1917;
    font-weight: 700;
}

.btxh-table-wrapper tr.btxh-highlight-row td.btxh-col-money .btxh-number,
.btxh-table-wrapper tr.btxh-highlight-row .btxh-number { color: #b45309; }

/* === Responsive detail panel === */
.btxh-table-wrapper .dtr-details > li { display: flex; gap: 12px; justify-content: space-between; }
.btxh-table-wrapper .dtr-title { color: #475569; font-size: 12px; font-weight: 700; }
.btxh-table-wrapper .dtr-data  { color: #1e3a8a; font-weight: 700; text-align: right; }

/* === Sticky columns (desktop) === */
@media (min-width: 769px) {
    .btxh-table-wrapper table.dataTable thead th.btxh-col-stt,
    .btxh-table-wrapper table.dataTable tbody td.btxh-col-stt {
        box-shadow: 3px 0 8px -4px rgba(15, 23, 42, .12);
        left: 0;
        position: sticky;
        z-index: 6;
    }

    .btxh-table-wrapper table.dataTable thead th.btxh-col-order,
    .btxh-table-wrapper table.dataTable tbody td.btxh-col-order,
    .btxh-table-wrapper table.dataTable thead th.btxh-col-place,
    .btxh-table-wrapper table.dataTable tbody td.btxh-col-place {
        box-shadow: 3px 0 8px -4px rgba(15, 23, 42, .12);
        left: 48px;
        position: sticky;
        z-index: 5;
    }

    .btxh-table-wrapper table.dataTable thead th.btxh-col-text,
    .btxh-table-wrapper table.dataTable tbody td.btxh-col-text {
        box-shadow: 3px 0 8px -4px rgba(15, 23, 42, .12);
        left: 120px;
        position: sticky;
        z-index: 4;
    }

    .btxh-table-wrapper table.dataTable thead th.btxh-col-stt,
    .btxh-table-wrapper table.dataTable thead th.btxh-col-order,
    .btxh-table-wrapper table.dataTable thead th.btxh-col-place,
    .btxh-table-wrapper table.dataTable thead th.btxh-col-text { z-index: 9; }

    .btxh-table-wrapper table.dataTable tbody td.btxh-col-stt,
    .btxh-table-wrapper table.dataTable tbody td.btxh-col-order,
    .btxh-table-wrapper table.dataTable tbody td.btxh-col-place,
    .btxh-table-wrapper table.dataTable tbody td.btxh-col-text { background: inherit !important; }
}

@media (max-width: 991px) {
    .btxh-insight-grid { grid-template-columns: 1fr 1fr; }

    .btxh-result-toolbar,
    .btxh-report-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 768px) {
    .btxh-insight-grid { grid-template-columns: 1fr; }

    .btxh-search-box { display: flex; flex-direction: column; }

    .btxh-search-box .search-group,
    .btxh-search-action,
    .btxh-search-action .btn-search-custom { width: 100%; }

    .btxh-search-action { padding-left: 0; }

    .btxh-search-action .btn-search-custom { justify-content: center; }
}
