:root {
    --soft-shadow: 0 6px 22px rgba(18, 38, 63, .08);
    --chip-bg: #f5f7fb;
}

body {
    background: #f7f8fb
}

.card-elevated {
    box-shadow: var(--soft-shadow);
    border: 0
}

/* Viền card đậm hơn mặc định Bootstrap (rgba mờ) để bo góc nhìn rõ, hài hoà nền xám nhạt. */
.card {
    border-color: #d7dce3;
}

/* Header */
.entity-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #e9f2ff, #f5f8ff);
    border: 1px solid #e4ecff;
    color: var(--primary);
}

a.entity-icon {
    text-decoration: none;
}

a.entity-icon:hover,
a.entity-icon:focus {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, #fff);
    border-color: color-mix(in srgb, var(--primary) 28%, #fff);
}

a.entity-icon:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
    outline-offset: 2px;
}

.entity-icon-setting {
    width: 36px;
    height: 36px;
}

@media (max-width: 575.98px) {
    .entity-icon:not(.entity-icon-setting) {
        width: 54px;
        height: 54px;
        border-radius: 14px;
        background: color-mix(in srgb, var(--primary) 10%, #fff);
        border-color: color-mix(in srgb, var(--primary) 22%, #fff);
        color: var(--primary);
    }

    .entity-icon:not(.entity-icon-setting) .bi {
        font-size: 26px !important;
    }

    .entity-icon:not(.entity-icon-setting) + div h5,
    .entity-icon:not(.entity-icon-setting) + div .h5 {
        font-size: 24px;
        line-height: 1.35;
        font-weight: 700;
    }
}

.meta-chip {
    background: var(--chip-bg);
    border: 1px solid #edf1f7;
    color: #445;
    padding: .4rem .6rem;
    border-radius: 10px;
    font-size: .9rem
}

.btn-kebab {
    border-radius: 12px
}

.app-alert-host {
    position: fixed;
    top: 18px;
    right: 18px;
    width: min(calc(100vw - 36px), 360px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1400;
    pointer-events: none;
}

.app-alert {
    --app-alert-accent: #f59e0b;
    --app-alert-shell-bg: color-mix(in srgb, var(--app-alert-accent) 12%, #ffffff);
    --app-alert-icon-bg: var(--app-alert-accent);
    --app-alert-eyebrow-color: color-mix(in srgb, var(--app-alert-accent) 74%, #475569);
    --app-alert-title-color: #12263f;
    --app-alert-message-color: #586174;
    --app-alert-border: color-mix(in srgb, var(--app-alert-accent) 18%, #dbe4f0);
    --app-alert-duration: 3000ms;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(248, 250, 252, .96)),
        radial-gradient(circle at top right, color-mix(in srgb, var(--app-alert-accent) 10%, transparent), transparent 48%);
    border: 1px solid var(--app-alert-border);
    border-radius: 18px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, .11);
    opacity: 0;
    transform: translate3d(0, -10px, 0) scale(.98);
    transition: opacity .22s ease, transform .22s ease, box-shadow .22s ease;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.app-alert.is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    box-shadow: 0 18px 36px rgba(15, 23, 42, .14);
}

.app-alert.is-leaving {
    opacity: 0;
    transform: translate3d(0, -10px, 0) scale(.98);
}

.app-alert__body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px 18px;
}

.app-alert__icon-shell {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--app-alert-shell-bg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
}

.app-alert__icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--app-alert-icon-bg);
    color: #ffffff;
    font-size: 12px;
    box-shadow: 0 8px 14px color-mix(in srgb, var(--app-alert-icon-bg) 24%, transparent);
}

.app-alert__content {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.app-alert__title {
    color: var(--app-alert-title-color);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 3px;
}

.app-alert__message {
    color: var(--app-alert-message-color);
    font-size: 12px;
    line-height: 1.4;
    word-break: break-word;
}

.app-alert__close {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .72);
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    margin-top: 0;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.app-alert__close:hover {
    background: rgba(241, 245, 249, .95);
    color: #64748b;
    transform: rotate(90deg);
}

.app-alert__close:focus-visible {
    outline: 2px solid rgba(59, 130, 246, .35);
    outline-offset: 2px;
}

.app-alert__progress {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 6px;
    height: 3px;
    border-radius: 999px;
    background: rgba(226, 232, 240, .72);
    overflow: hidden;
}

.app-alert__progress-bar {
    width: 100%;
    height: 100%;
    transform-origin: left center;
    transform: scaleX(1);
    background: var(--app-alert-accent);
    transition-property: transform;
    transition-timing-function: linear;
}

.app-alert--success {
    --app-alert-accent: #22c55e;
    --app-alert-title-color: #14532d;
    --app-alert-message-color: #46615a;
}

.app-alert--warning {
    --app-alert-accent: #f59e0b;
    --app-alert-title-color: #9a6700;
    --app-alert-message-color: #6e5b31;
}

.app-alert--danger {
    --app-alert-accent: #ef4444;
    --app-alert-title-color: #991b1b;
    --app-alert-message-color: #6f4951;
}

@media (max-width: 576px) {
    .app-alert-host {
        top: 12px;
        right: 12px;
        left: 12px;
        width: calc(100vw - 24px);
    }

    .app-alert__body {
        gap: 10px;
        padding: 11px 12px 17px;
    }

    .app-alert__icon-shell {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .app-alert__progress {
        left: 12px;
        right: 12px;
    }
}

.app-toast-host {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1350;
    width: min(calc(100vw - 36px), 340px);
    pointer-events: none;
}

.app-toast {
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(248, 250, 252, .96)),
        radial-gradient(circle at top right, rgba(37, 99, 235, .08), transparent 48%);
    border: 1px solid rgba(191, 219, 254, .8);
    box-shadow: 0 14px 30px rgba(15, 23, 42, .12);
    color: #12263f;
    pointer-events: auto;
}

.app-toast__body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
}

.app-toast__icon-shell {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(219, 234, 254, .9);
}

.app-toast__icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-size: 12px;
    box-shadow: 0 8px 14px rgba(37, 99, 235, .24);
}

.app-toast__content {
    flex: 1;
    min-width: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.app-toast__title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 3px;
    color: #0f2f57;
}

.app-toast__message {
    padding: 0;
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: #586174;
    word-break: break-word;
}

.app-toast__close {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .72);
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.app-toast__close:hover {
    background: rgba(241, 245, 249, .95);
    color: #64748b;
    transform: rotate(90deg);
}

.app-toast__close:focus-visible {
    outline: 2px solid rgba(59, 130, 246, .35);
    outline-offset: 2px;
}

@media (max-width: 576px) {
    .app-toast-host {
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
    }

    .app-toast__body {
        gap: 10px;
        padding: 11px 12px;
    }

    .app-toast__icon-shell {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }
}

.modal-content {
    top: 30px;
}

.modal-fullscreen-lg-down .modal-content,
.modal-fullscreen-sm-down .modal-content,
.modal-fullscreen .modal-content {
    top: 0;
}

/*--------------------------------------------
-------------------FORM-----------------------
--------------------------------------------*/
input.form-control,
.form-select {
    height: 36px;
    display: flex;
    align-items: center;
}

.form-control:focus,
.form-select:focus {
    box-shadow: none;
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper .form-control {
    padding-right: 42px;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    z-index: 2;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #6c757d;
    transform: translateY(-50%);
}

.password-toggle-btn:hover {
    color: #212529;
}

.password-toggle-btn:focus {
    box-shadow: none !important;
}

.password-toggle-btn:focus-visible {
    outline: 2px solid rgba(13, 110, 253, .35);
    outline-offset: 1px;
}

button,
.btn {
    height: 36px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 4px;
}

span.field-validation-error {
    color: red;
    font-size: 13px;
}

span.required {
    color: red;
}

a.btn.btn-filter {
    height: 28px;
    width: 28px;
    justify-content: center;
    background: #ddd;
    border-radius: 50%;
    color: #666666;
}

a.btn.btn-filter:hover {
    background: #6e6e6e;
    color: #fff;
}

.field-value.field-checkbox {
    display: flex;
    align-items: center;
    justify-content: start;
}

.field-value.field-checkbox input {
    margin: 0;
}

button:focus {
    box-shadow: none !important;
}

@media (max-width: 575.98px) {
    input.form-control:not([type="checkbox"]):not([type="radio"]):not(.form-control-color),
    .form-select {
        height: 40px;
        min-height: 40px;
        border-radius: 8px;
        font-size: 16px;
    }

    textarea.form-control {
        height: auto;
        min-height: 96px;
        font-size: 16px;
        border-radius: 8px;
    }

    .input-group-text {
        min-height: 40px;
        border-radius: 8px;
        font-size: 16px;
    }

    button:not(.btn-close):not(.navbar-toggler):not(.icon-btn):not(.btn-act-tb):not(.btn-pagination):not(.btn-24px):not(.btn-filter):not(.password-toggle-btn):not(.btn-qty):not(.btn-delete-item):not(.app-alert__close):not(.app-toast__close):not(.accordion-button):not(.backdrop-close):not(.group-toggle):not(.sidebar-toggle-btn):not(.rail-link):not(.remove-product),
    .btn:not(.btn-close):not(.navbar-toggler):not(.icon-btn):not(.btn-act-tb):not(.btn-pagination):not(.btn-24px):not(.btn-filter):not(.password-toggle-btn):not(.btn-qty):not(.btn-delete-item):not(.app-alert__close):not(.app-toast__close):not(.accordion-button):not(.backdrop-close):not(.group-toggle):not(.sidebar-toggle-btn):not(.rail-link):not(.remove-product) {
        height: 40px;
        min-height: 40px;
        min-width: 80px;
        padding: 0 14px;
        justify-content: center;
        border-radius: 8px;
        font-size: 16px;
        line-height: 1;
    }

    .btn-primary {
        background: var(--primary);
        border-color: var(--primary);
    }

    .btn-outline-primary,
    .btn-outline-secondary:not(.btn-act-tb):not(.btn-pagination):not(.icon-btn):not(.btn-qty):not(.btn-delete-item):not(.btn-filter):not(.remove-product) {
        color: var(--primary);
        background: #fff;
        border-color: var(--primary);
    }

    .btn-outline-primary:hover,
    .btn-outline-primary:focus,
    .btn-outline-secondary:not(.btn-act-tb):not(.btn-pagination):not(.icon-btn):not(.btn-qty):not(.btn-delete-item):not(.btn-filter):not(.remove-product):hover,
    .btn-outline-secondary:not(.btn-act-tb):not(.btn-pagination):not(.icon-btn):not(.btn-qty):not(.btn-delete-item):not(.btn-filter):not(.remove-product):focus {
        color: #fff;
        background: var(--primary);
        border-color: var(--primary);
    }
}

/*--------------------------------------------
-------------------TABLE----------------------
--------------------------------------------*/
table {
    min-width: max-content;
    width: 100%;
}

/* Nút thao tác trong lưới (sửa/xóa): inline-flex để các nút cùng nằm một dòng
   (rule global button,.btn display:flex là block → sinh xếp chồng dọc), viền rõ nền trắng. */
.btn.btn-act-tb {
    display: inline-flex;
    align-items: center;
    width: 26px;
    height: 26px;
    justify-content: center;
    padding: 0;
    font-size: 14px;
    border: 1px solid #cdd4de;
    border-radius: 4px;
    background: #fff;
    color: #475569;
}

.btn.btn-act-tb:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f2f7ff;
}

/* Khoảng cách nhỏ giữa các nút thao tác khi nằm cùng dòng. */
td.text-nowrap .btn-act-tb + .btn-act-tb,
td.text-nowrap .btn-act-tb + form,
td.text-nowrap form + .btn-act-tb {
    margin-left: 4px;
}

.app-pagination {
    border-radius: 0 0 8px 8px;
}

.btn-pagination {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-color: #efefef !important;
}

.btn-pagination:hover {
    background: #e9e9e9;
}

.btn-pagination.disabled {
    opacity: .6;
}

.btn-pagination.disabled:hover {
    background: white;
}

a.selected-asc:link,
a.selected-asc:visited,
a.selected-asc:hover,
a.selected-asc:active {
    padding-right: 20px;
    background: url(/img/arrow-down.png) no-repeat center right;
}

a.selected-desc:link,
a.selected-desc:visited,
a.selected-desc:hover,
a.selected-desc:active {
    padding-right: 20px;
    background: url(/img/arrow-up.png) no-repeat center right;
}

a.selected-none {
    padding-right: 20px;
    background: url(/img/arrow-none.png) no-repeat center right;
}

.column-value {
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

th a,
td a {
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}

/* Rule td a width:100% ở trên dành cho link dữ liệu; link-nút action trong ô không được giãn. */
td a.btn {
    width: auto;
}

tr.tr-filter input.form-control,
tr.tr-filter .btn {
    height: 32px;
}

td {
    max-width: 350px;
}

/* Cố định cột cuối cùng */
.table .sticky-last {
    position: sticky;
    right: 0;
    z-index: 5;
    /*border-right: 1px solid #fff;*/
}

.app-pagination .page-link {
    padding: 3px 11px;
}

.app-pagination li.page-item.disabled a {
    background: #f5f5f5;
}

.app-line:last-child {
    display: none;
}

.btn-pagination:disabled {
    background: #e9e9e9;
}

.table-responsive::-webkit-scrollbar,
.app-content-wrapper::-webkit-scrollbar,
.overflow-auto::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-responsive::-webkit-scrollbar-track,
.app-content-wrapper::-webkit-scrollbar-track,
.overflow-auto::-webkit-scrollbar-track {
    background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb,
.app-content-wrapper::-webkit-scrollbar-thumb,
.overflow-auto::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .55);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
}

    .table-responsive::-webkit-scrollbar-thumb:hover,
    .app-content-wrapper::-webkit-scrollbar-thumb:hover,
    .overflow-auto::-webkit-scrollbar-thumb:hover {
        background: rgba(100, 116, 139, .65);
        border: 3px solid transparent;
        background-clip: content-box;
    }

/*--------------------------------------------
-------------------TIEN ICH-------------------
--------------------------------------------*/
.min-h-32px {
    min-height: 32px;
}

.min-w-120px {
    min-width: 120px;
}

.w-40px {
    width: 40px;
}

.text-ellipsis {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 0;
}

.w-0 {
    width: 0 !important;
}

.h-0 {
    height: 0 !important;
}

.h-36 {
    height: 36px;
}

.cursor-pointer {
    cursor: pointer;
}


/*--------------------------------------------
-------------------MODAL----------------------
--------------------------------------------*/
/* Shared dialog polish */
.modal-content {
    border: 0;
    border-radius: 18px;
    box-shadow: var(--shadow)
}

.modal-header {
    border: 0
}

.modal-footer {
    border: 0
}

/* Modal nội dung dài: header/footer cố định, thân (.modal-body) tự cuộn thay vì
   cả modal trôi theo scroll của .modal như mặc định Bootstrap.
   Chặn chiều cao = 100dvh − 2 lần margin dialog (biến Bootstrap: 8px mobile,
   28px desktop) − 48px offset top của .modal-content (block định vị ở đầu file). */
.modal:not(.modal-fullscreen):not(.modal-fullscreen-lg-down):not(.modal-fullscreen-sm-down) .modal-dialog > .modal-content {
    max-height: calc(100vh - var(--bs-modal-margin) * 2 - 48px);
    max-height: calc(100dvh - var(--bs-modal-margin) * 2 - 48px);
    overflow: hidden; /* cắt thân cuộn theo bo góc 18px của modal */
}

/* Dialog căn giữa: content nằm giữa dialog cao gần trọn viewport rồi mới offset 48px,
   nên phải chừa gấp đôi (96px) để đáy modal không lọt khỏi màn hình.
   Selector phải đặc hiệu bằng rule trên (ghi đè max-height theo thứ tự cascade). */
.modal:not(.modal-fullscreen):not(.modal-fullscreen-lg-down):not(.modal-fullscreen-sm-down) .modal-dialog.modal-dialog-centered > .modal-content {
    max-height: calc(100vh - var(--bs-modal-margin) * 2 - 96px);
    max-height: calc(100dvh - var(--bs-modal-margin) * 2 - 96px);
}

/* cho phép thân cuộn độc lập (flex item cần min-height:0 mới co dưới nội dung) */
.modal-body {
    overflow-y: auto;
    min-height: 0;
}

/* Vài màn (MatHang, KhoHang, NhanVien, NhomHang, TienTe, KhachHang) đặt
   header/body/footer trong <form> trực tiếp — form phải tiếp tục là flex column
   (min-height:0) để chuỗi co chiều cao từ .modal-content xuống .modal-body liền mạch. */
.modal:not(.modal-fullscreen):not(.modal-fullscreen-lg-down):not(.modal-fullscreen-sm-down) .modal-dialog > .modal-content > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Firefox (không hỗ trợ ::-webkit-scrollbar): dùng chuẩn scrollbar-*.
   Đặt selector() trong @supports để Chrome/Edge không bật chế độ chuẩn
   (scrollbar-width khác auto khiến webkit pseudo bị bỏ qua, sinh lại mũi tên). */
@supports not selector(::-webkit-scrollbar) {
    .modal-body {
        scrollbar-width: thin;
        scrollbar-color: rgba(100, 116, 139, .35) transparent;
    }
}

/* Thanh cuộn mảnh, bo tròn, thumb nổi 6px trên nền trong suốt (lớp border
   trong + background-clip) — gọn nhẹ, không chạm mép bo của modal. */
.modal-body::-webkit-scrollbar {
    width: 12px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-button {
    display: none; /* bỏ mũi tên hai đầu cho thanh cuộn gọn */
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, .35);
    border: 3px solid transparent;
    border-radius: 999px;
    background-clip: content-box;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(100, 116, 139, .55);
}

/* === EFFECT: ZOOM === */
.modal.fx-zoom .modal-dialog {
    transform: scale(.92);
    opacity: 0;
    transition: transform .28s ease, opacity .28s ease;
}

.modal.show.fx-zoom .modal-dialog {
    transform: scale(1);
    opacity: 1
}

/* === EFFECT: SLIDE-UP === */
.modal.fx-slide .modal-dialog {
    transform: translateY(16px);
    opacity: 0;
    transition: transform .28s ease, opacity .28s ease;
}

.modal.show.fx-slide .modal-dialog {
    transform: translateY(0);
    opacity: 1
}

/* === EFFECT: FLIP === */
.modal.fx-flip .modal-dialog {
    transform: perspective(800px) rotateX(-12deg) translateY(6px);
    opacity: 0;
    transition: transform .32s cubic-bezier(.2, .75, .2, 1), opacity .26s ease;
    transform-origin: 50% -10%;
}

.modal.show.fx-flip .modal-dialog {
    transform: perspective(800px) rotateX(0) translateY(0);
    opacity: 1
}

/* Little pulse on the primary button when modal shows */
.modal.show .btn-primary.pulse {
    animation: pulse .8s ease .25s 1
}

body::-webkit-scrollbar {
    width: 0;
}

@keyframes pulse {
    0% {
        transform: scale(1)
    }

    50% {
        transform: scale(1.035)
    }

    100% {
        transform: scale(1)
    }
}

@media (max-width: 576px) {
    .w-80-on-mobile {
        max-width: 80px;
    }

    .w-180-on-mobile {
        max-width: 180px;
    }

    .w-sm-100 {
        width: 100%!important;
    }
}

@media (max-width: 767.98px) {
    .w-flex-wrap {
        width: 100%;
    }
}

@media (min-width: 768) {
    .w-flex-wrap {
        width: auto;
    }
}

/*-----------------CSS ModalPreviewImage---------------*/
#imgModal .modal-dialog {
    margin: 0;
}

#imgModal .modal-content {
    height: 100dvh;
    min-height: 100vh;
    max-height: none; /* preview ảnh luôn full-screen, không áp trần chặn chiều cao modal thường */
    background: radial-gradient(1200px 800px at 50% 10%, #16213b 0%, #0b1220 56%, #050812 100%);
    border: 0;
    color: #e2e8f0;
    overflow: hidden;
}

#imgModal .modal-header {
    flex: 0 0 auto;
    border: 0;
    padding: .75rem clamp(1rem, 2vw, 1.5rem);
    background: rgba(8, 13, 25, .82);
    color: #e2e8f0;
    backdrop-filter: blur(14px);
    box-shadow: 0 1px 0 rgba(148, 163, 184, .14);
}

#imgModal .modal-title {
    font-weight: 600;
    letter-spacing: .2px;
}

#imgModal .btn-close {
    filter: invert(1) grayscale(100%);
    opacity: .85;
}

#imgModal .btn-close:hover {
    opacity: 1;
}

#imgModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    position: relative;
}

#imgModal .pz-wrap {
    --pz-edge-space: clamp(14px, 3vw, 32px);
    --pz-toolbar-space: 88px;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: grid;
    place-items: center;
    padding: var(--pz-edge-space) var(--pz-edge-space) calc(var(--pz-toolbar-space) + env(safe-area-inset-bottom)) var(--pz-edge-space);
    user-select: none;
    isolation: isolate;
}

#imgModal .pz-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 10%, rgba(59, 130, 246, .18), transparent 30%),
        radial-gradient(circle at 80% 80%, rgba(14, 165, 233, .12), transparent 34%),
        linear-gradient(135deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, 0));
}

#imgModal .backdrop-close {
    position: absolute;
    inset: 0;
    border: 0;
    background: transparent;
    cursor: zoom-out;
    z-index: 1;
}

#imgModal .pz-inner {
    position: relative;
    z-index: 2;
    touch-action: none;
    cursor: grab;
    will-change: transform;
    opacity: 1;
    transition: opacity .12s ease;
}

#imgModal .pz-wrap.is-fitting .pz-inner {
    opacity: 0;
}

#imgModal .pz-inner:active {
    cursor: grabbing;
}

/* JS kiểm soát kích thước ảnh để giữ đúng tỉ lệ trên mọi thiết bị. */
#imgModal img#previewImg {
    display: block;
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
    -webkit-user-drag: none;
    user-select: none;
}

#imgModal .pz-toolbar {
    position: absolute;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 4;
    display: flex;
    gap: 8px;
    max-width: calc(100% - 24px);
    padding: 8px 10px;
    background: rgba(5, 10, 22, .72);
    border: 1px solid rgba(226, 232, 240, .18);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    box-shadow: 0 16px 42px rgba(0, 0, 0, .38);
}

#imgModal .pz-toolbar .btn {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #0f172a;
    background: rgba(248, 250, 252, .92);
}

#imgModal .pz-toolbar .btn:hover,
#imgModal .pz-toolbar .btn:focus-visible {
    background: #fff;
    color: #020617;
}

#imgModal .pz-hint {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(226, 232, 240, .92);
    background: rgba(5, 10, 22, .6);
    border: 1px solid rgba(226, 232, 240, .14);
    border-radius: 14px;
    padding: 9px 12px;
    backdrop-filter: blur(14px);
}

.btn-24px {
    width: 24px;
    height: 24px;
    padding: 0 4px;
}

.h-36 {
    height: 36px;
}
.w-36 {
    width: 36px;
}

@media (max-width: 576px) {
    #imgModal .modal-header {
        padding: .65rem .875rem;
    }

    #imgModal .pz-wrap {
        --pz-edge-space: 10px;
        --pz-toolbar-space: 76px;
    }

    #imgModal .pz-toolbar {
        gap: 6px;
        padding: 7px 8px;
        border-radius: 14px;
    }

    #imgModal .pz-toolbar .btn {
        width: 38px;
        height: 38px;
        border-radius: 11px;
    }

    #imgModal .pz-hint {
        display: none;
    }

    .card.card-elevated {
        border-radius: 0 !important;
    }
}

.layout-shell {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/*--------------------------------------------------------
-------------------LANGUAGE SWITCHER----------------------
----------------------------------------------------------
*/
.app-header .icon-btn.icon-lang:hover {
    background: transparent;
}

.app-language-switcher .app-language-toggle {
    width: auto;
    min-width: 3.75rem;
    height: 2.25rem;
    padding: .35rem .55rem;
    border-radius: 999px;
    gap: .4rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    font-size: .85rem;
    font-weight: 700;
}

    .app-language-switcher .app-language-toggle:hover,
    .app-language-switcher .app-language-toggle:focus {
        background: #f1f5f9;
        color: #111827;
    }

.app-language-switcher .app-language-menu {
    min-width: 9rem;
    padding: .4rem;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
}

.app-language-switcher .app-language-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    border-radius: 10px;
    padding: .55rem .7rem;
    font-weight: 600;
}

    .app-language-switcher .app-language-item.active,
    .app-language-switcher .app-language-item:active {
        background: #eef2ff;
        color: #1e3a8a;
    }

.app-language-flag {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.app-language-code {
    line-height: 1;
}

.app-language-chevron {
    font-size: .7rem;
}

/* Bo góc lưới sắc nét: table-responsive (vuông, nền thead xám) là child đầu của card →
   clip corner của chính nó khớp radius card (overflow-x:auto đã cắt nội dung hai chiều). */
.card > .table-responsive:first-child {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

/* Khi không có _Pagination (lưới duy nhất trong card) thì clip cả góc dưới. */
.card > .table-responsive:only-child {
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}
