:root {
    --soft-shadow: 0 6px 22px rgba(18, 38, 63, .08);
    --chip-bg: #f5f7fb;
    --app-main-max-width: 1680px;
    --app-brand: #007ec7;
    --app-brand-strong: #005fa3;
}

body {
    background: #f7f8fb
}

.btn-primary {
    background: linear-gradient(135deg, var(--app-brand), var(--app-brand-strong));
    border: 0;
    color: #fff;
    /*box-shadow: 0 12px 28px rgba(0, 95, 163, .20);*/
}

.active > .page-link, .page-link.active {
    background: linear-gradient(135deg, var(--app-brand), var(--app-brand-strong)) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle,
.btn-check:checked + .btn-primary,
.btn-check:active + .btn-primary {
    background: linear-gradient(135deg, var(--app-brand-strong), #0d4f8b);
    border: 0;
    color: #fff;
    box-shadow: 0 12px 28px rgba(0, 95, 163, .24);
}

.btn-primary:focus,
.btn-check:focus + .btn-primary {
    box-shadow: 0 0 0 .2rem rgba(0, 126, 199, .18), 0 12px 28px rgba(0, 95, 163, .20);
}

.btn-primary:disabled,
.btn-primary.disabled {
    background: linear-gradient(135deg, #68addb, #4e96c8);
    border: 0;
    color: #fff;
}

.btn-outline-primary {
    color: var(--app-brand);
    border-color: rgba(0, 126, 199, .45);
    background: rgba(255, 255, 255, .92);
    /*box-shadow: 0 8px 20px rgba(0, 95, 163, .08);*/
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active,
.show > .btn-outline-primary.dropdown-toggle,
.btn-check:checked + .btn-outline-primary,
.btn-check:active + .btn-outline-primary {
    background: linear-gradient(135deg, var(--app-brand), var(--app-brand-strong));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 12px 28px rgba(0, 95, 163, .20);
}

.btn-outline-primary:focus,
.btn-check:focus + .btn-outline-primary {
    box-shadow: 0 0 0 .2rem rgba(0, 126, 199, .18), 0 12px 28px rgba(0, 95, 163, .12);
}

.bg-primary,
.text-bg-primary {
    background: linear-gradient(135deg, var(--app-brand), var(--app-brand-strong)) !important;
    color: #fff !important;
}

.app-main-max {
    max-width: var(--app-main-max-width);
    margin-inline: auto;
    width: 100%;
}

.app-main-shell {
    padding-left: 1rem;
    padding-right: 1rem;
}

.app-main-shell .container.page,
.app-main-shell .container.page>.container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

@media (min-width: 1400px) {
    .app-main-shell {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
}

.card-elevated {
    box-shadow: var(--soft-shadow);
    border: 0
}

/* Header */
/* Size theo rem để mật độ responsive (xem header.css) co được icon trên màn nhỏ. */
.entity-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #e9f2ff, #f5f8ff);
    border: 1px solid #e4ecff;
    color: #0d6efd
}

.entity-icon-setting {
    width: 2.25rem;
    height: 2.25rem;
}

.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
}

#alert,
#alert-failure,
#alert-success {
    display: none;
}

.app-alert-stack {
    position: fixed;
    top: 64px;
    right: 18px;
    width: min(420px, calc(100vw - 24px));
    z-index: 1056;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-alert {
    position: relative;
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: 10px;
    align-items: start;
    background: #fff;
    border-radius: 14px;
    padding: 12px 12px 10px;
    border: 1px solid #e8edf5;
    box-shadow: 0 14px 38px rgba(16, 24, 40, .14);
    transform: translateX(14px);
    opacity: 0;
    pointer-events: auto;
    transition: transform .24s ease, opacity .24s ease, box-shadow .2s ease;
    overflow: hidden;
}

.app-alert.is-visible {
    transform: translateX(0);
    opacity: 1;
}

.app-alert.is-leaving {
    transform: translateX(14px);
    opacity: 0;
}

.app-alert:hover {
    box-shadow: 0 16px 42px rgba(16, 24, 40, .18);
}

.app-alert__icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 18px;
}

.app-alert__title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 3px;
}

.app-alert__message {
    font-size: 13px;
    color: #475467;
    line-height: 1.45;
    word-break: break-word;
}

.app-alert__close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #98a2b3;
    display: grid;
    place-items: center;
    transition: background .2s ease, color .2s ease;
}

.app-alert__close:hover {
    background: #f2f4f7;
    color: #344054;
}

.app-alert__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: rgba(16, 24, 40, .08);
}

.app-alert__progress > span {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: left center;
    animation: appAlertCountdown linear forwards;
}

.app-alert--success .app-alert__icon {
    color: #067647;
    background: #ecfdf3;
}

.app-alert--success .app-alert__title {
    color: #067647;
}

.app-alert--success .app-alert__progress > span {
    background: #12b76a;
}

.app-alert--danger .app-alert__icon,
.app-alert--error .app-alert__icon {
    color: #b42318;
    background: #fef3f2;
}

.app-alert--danger .app-alert__title,
.app-alert--error .app-alert__title {
    color: #b42318;
}

.app-alert--danger .app-alert__progress > span,
.app-alert--error .app-alert__progress > span {
    background: #f04438;
}

.app-alert--warning .app-alert__icon {
    color: #b54708;
    background: #fffaeb;
}

.app-alert--warning .app-alert__title {
    color: #b54708;
}

.app-alert--warning .app-alert__progress > span {
    background: #f79009;
}

.app-alert--info .app-alert__icon {
    color: #175cd3;
    background: #eff8ff;
}

.app-alert--info .app-alert__title {
    color: #175cd3;
}

.app-alert--info .app-alert__progress > span {
    background: #2e90fa;
}

@keyframes appAlertCountdown {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@media (max-width: 576px) {
    .app-alert-stack {
        top: 56px;
        right: 8px;
        width: calc(100vw - 16px);
    }
}

/*.modal-content {
    top: 48px;
}*/

.modal-fullscreen-lg-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;
}

button,
.btn {
    height: 36px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
}

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;
}

/*--------------------------------------------
-------------------TABLE----------------------
--------------------------------------------*/
table {
    min-width: max-content;
    width: 100%;
}

.btn.btn-act-tb {
    width: 26px;
    height: 26px;
    justify-content: center;
    font-size: 14px;
    border-radius: 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;
}

tr.tr-filter input.form-control,
tr.tr-filter .btn {
    height: 32px;
}

td {
    max-width: 350px;
}

/* Đồng bộ tiêu đề cột không sắp xếp với cột có sắp xếp (nút .btn fw-semibold).
 * Lý do: Bootstrap 5 không còn chuyển .align-middle từ <table> xuống ô nên ô mặc định
 * bottom-align, làm chữ cột thường lệch thấp hơn nút sắp xếp; th mặc định bold 700. */
.table thead th {
    font-weight: 600;
}

.table.align-middle > thead > tr > th {
    vertical-align: middle;
}

/* Cố định cột cuối cùng */
.table .sticky-last {
    position: sticky;
    right: 0;
    z-index: 5;
    /*border-right: 1px solid #fff;*/
}

/* Giữ tên cột cố định trong các bảng có vùng scroll riêng. */
.app-table-sticky-wrap .table thead th {
    position: sticky;
    top: 0;
    z-index: 6;
    background: var(--bs-secondary-bg);
}

.app-table-sticky-wrap .table thead th.sticky-last {
    z-index: 7;
}

.app-table-sticky-wrap .table tbody td.sticky-last {
    background: #fff;
}

/* Cố định cột đầu tiên: giữ cột định danh (vd Số phiếu) khi bảng cuộn ngang */
.table .sticky-first {
    position: sticky;
    left: 0;
    z-index: 5;
}

/* Ô giao giữa header ghim trên và cột ghim trái phải nổi hơn cả hai */
.app-table-sticky-wrap .table thead th.sticky-first {
    z-index: 7;
}

/* Nền đặc để cột cuộn qua bị che khuất; hover của Bootstrap 5.3 vẽ bằng inset
   box-shadow đè trên nền này nên vẫn hiện màu hover — không thêm box-shadow ở đây. */
.app-table-sticky-wrap .table tbody td.sticky-first {
    background: #fff;
    border-right: 1px solid var(--bs-border-color);
}

.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;
}

@media (max-width: 768px) {
    .app-pagination {
        border-top: 1px solid #dee2e6 !important;
        border-radius: 4px;
    }
}

/*--------------------------------------------
-------------------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
}

/* === 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;
    }
}

@media (max-width: 767.98px) {
    .w-flex-wrap {
        width: 100%;
    }
}

@media (min-width: 768) {
    .w-flex-wrap {
        width: auto;
    }
}

/*-----------------CSS ModalPreviewImage---------------*/
/* 100dvh = chiều cao hiển thị thực của trình duyệt (mobile còn URL bar); dialog
   Bootstrap mặc định dùng 100vh nên phần dưới ảnh/toolbar bị che trên điện thoại. */
#imgModal .modal-dialog {
    height: 100dvh;
}

#imgModal .modal-content {
    background: radial-gradient(1200px 800px at 50% 10%, #111c33 0%, #0b1220 55%, #070b14 100%);
    border: 0;
    overflow: hidden;
}

#imgModal .modal-header {
    border: 0;
    padding: .75rem 1rem;
    background: rgba(15, 23, 42, .78);
    color: #e2e8f0;
    backdrop-filter: blur(10px);
}

#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;
}

/* modal-body là flex item của modal-content nên tự chiếm hết chiều cao còn lại
   sau header; không trừ pixel cứng (header đổi cao độ là ảnh lệch tâm). */
#imgModal .modal-body {
    padding: 0;
    position: relative;
    overflow: hidden;
    display: flex;
}

/* ===== Workspace ===== */
#imgModal .pz-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    /* Chừa chỗ cho toolbar nổi để ảnh "fit" không bị che cạnh dưới */
    padding-bottom: 72px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
    /* Dùng flex căn giữa; grid track auto sẽ giãn theo kích thước gốc của ảnh
       làm ảnh to hơn màn hình bị lệch khỏi tâm (không căn giữa trên màn hình phân giải thấp). */
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

/* Click-outside-to-close layer */
#imgModal .backdrop-close {
    /* Rule toàn cục "button, .btn { height: 36px }" ở trên làm lớp nền này chỉ cao 36px,
       click ra ngoài ảnh không đóng modal như aria-label mô tả -> đặt kích thước tường minh. */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    /* Layer này click vào là đóng modal, không phải zoom -> bỏ con trỏ zoom-out */
    cursor: default;
    z-index: 1;
}

/* Panzoom area */
#imgModal .pz-inner {
    position: relative;
    z-index: 2;
    touch-action: none;
    cursor: grab;
    will-change: transform;
    /* Giữ kích thước gốc theo ảnh, không bị flex co lại khi ảnh to hơn wrap */
    flex: none;
}

#imgModal .pz-inner:active {
    cursor: grabbing;
}

/* IMPORTANT: để JS “fit” chính xác, không ép max-width/max-height ở CSS nữa */
#imgModal img#previewImg {
    display: block;
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    -webkit-user-drag: none;
    user-select: none;
}

/* ===== Toolbar ===== */
#imgModal .pz-toolbar {
    position: absolute;
    left: 50%;
    bottom: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(2, 6, 23, .55);
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 14px;
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
}

#imgModal .pz-toolbar .btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    padding: 0;
}

#imgModal .pz-hint {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    font-size: 12px;
    color: rgba(226, 232, 240, .9);
    background: rgba(2, 6, 23, .45);
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 12px;
    padding: 8px 10px;
    backdrop-filter: blur(10px);
}

@media (max-width: 576px) {
    #imgModal .pz-hint {
        display: none;
    }
    .w-sm-100 {
        width: 100% !important;
    }
}

/*------------SCROLLBAR------------*/
.sidebar-nav.overflow-y-auto::-webkit-scrollbar,
.dashboard-tab-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.my-work-list::-webkit-scrollbar,
.product-group-tree-list::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
.app-content-wrapper::-webkit-scrollbar,
.overflow-y-auto::-webkit-scrollbar,
.overflow-auto::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.my-work-list::-webkit-scrollbar-track,
.product-group-tree-list::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track,
.app-content-wrapper::-webkit-scrollbar-track,
.overflow-y-auto::-webkit-scrollbar-track,
.overflow-auto::-webkit-scrollbar-track {
    background: transparent;
}

.my-work-list::-webkit-scrollbar-thumb,
.product-group-tree-list::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb,
.app-content-wrapper::-webkit-scrollbar-thumb,
.overflow-y-auto::-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;
}

    .my-work-list::-webkit-scrollbar-thumb:hover,
    .product-group-tree-list::-webkit-scrollbar-thumb:hover,
    .table-responsive::-webkit-scrollbar-thumb:hover,
    .app-content-wrapper::-webkit-scrollbar-thumb:hover,
    .overflow-y-auto::-webkit-scrollbar-thumb:hover,
    .overflow-auto::-webkit-scrollbar-thumb:hover {
        background: rgba(100, 116, 139, .65);
        border: 3px solid transparent;
        background-clip: content-box;
    }

.crm-chat-toolbar {
    position: fixed;
    right: 0;
    bottom: 20px;
    z-index: 2147483000;
    display: flex;
    width: 64px;
    height: 108px;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.crm-chat-toolbar--collapsed .crm-chat-toolbar__actions {
    opacity: 0;
    visibility: hidden;
    transform: translateX(84px);
}

.crm-chat-toolbar--chat-open .crm-chat-toolbar__toggle {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.crm-chat-toolbar__toggle {
    display: grid;
    width: 18px;
    height: 36px;
    padding: 0;
    color: #fff;
    background: #0d6efd;
    border: 0;
    border-radius: 6px 0 0 6px;
    place-items: center;
    box-shadow: 0 4px 14px rgba(13, 110, 253, .32);
    transition: opacity .15s ease, background-color .15s ease, visibility 0s linear 0s;
}

.crm-chat-toolbar__toggle:hover {
    background: #0b5ed7;
}

.crm-chat-toolbar__actions {
    display: flex;
    width: 64px;
    height: 64px;
    max-height: 64px;
    flex: 0 0 64px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: opacity .15s ease, transform .3s ease, visibility 0s linear 0s;
}

.crm-chat-toolbar--collapsed .crm-chat-toolbar__actions {
    transition: opacity .15s ease, transform .3s ease, visibility 0s linear .15s;
}

.crm-chat-toolbar .woot--bubble-holder {
    position: relative;
    width: 64px;
    height: 64px;
}

.crm-chat-toolbar .woot-widget-bubble {
    position: absolute !important;
    inset: 0 !important;
}

@media (max-width: 576px) {
    .crm-chat-toolbar {
        right: 0;
        bottom: 12px;
        width: 56px;
        height: 98px;
        gap: 8px;
    }

    .crm-chat-toolbar__toggle {
        width: 18px;
        height: 34px;
    }

    .crm-chat-toolbar__actions {
        width: 56px;
        height: 56px;
        flex-basis: 56px;
        gap: 8px;
    }

    .crm-chat-toolbar .woot--bubble-holder,
    .crm-chat-toolbar .woot-widget-bubble {
        width: 56px !important;
        height: 56px !important;
    }

    .crm-chat-toolbar .woot-widget-bubble svg {
        width: 22px;
        height: 22px;
        margin: 17px;
    }
}

.w-36 {
    width: 36px;
}

.table tr:last-child {
    border-color: transparent;
}

.table.product-table tr:last-child {
    border-color: #dee2e6;
}

.table.table-2 tr:last-child {
    border-color: #dee2e6;
}

.table thead tr:last-child {
    border-color: #dee2e6;
}

.dayContainer {
    padding-top: 1px;
}

span#notificationBadge {
    font-size: 11px;
}

/* Lưới field 2 cột độc lập trên form thêm/sửa: form-field-layout.js gán grid-column/grid-row cho từng ô
   theo cấu hình của user, nên kéo trong cột nào chỉ đổi thứ tự cột đó và ô bị ẩn (display:none)
   không làm xô hàng của cột kia như lưới flex một dãy. */
.form-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.5rem;
}

/* Cột của từng ô do form-field-layout.js gán qua data-field-col; hàng đặt inline style grid-row. */
.form-field-grid > [data-field-col="1"] {
    grid-column: 1;
}

.form-field-grid > [data-field-col="2"] {
    grid-column: 2;
}

@media (max-width: 575.98px) {
    .form-field-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Màn hẹp về 1 cột: bỏ vị trí cột/hàng đã gán để field chảy theo thứ tự DOM, đúng thứ tự user đã xếp. */
    .form-field-grid > * {
        grid-column: auto !important;
        grid-row: auto !important;
    }
}

/* Hộp thoại "Tùy chỉnh hiển thị field": hai danh sách tương ứng hai cột trên form,
   kéo qua lại giữa hai danh sách bằng connectWith của jQuery UI. */
.form-layout-column {
    min-width: 0;
}

.form-layout-list {
    min-height: 2.75rem;
}

.form-layout-cell {
    padding-bottom: .5rem;
}

.form-layout-item {
    transition: opacity .15s ease;
}

.form-layout-item--hidden {
    opacity: .55;
    border-style: dashed;
    background-color: var(--bs-body-bg);
}

/* Nhãn chiếm phần còn lại và được phép co lại (min-width:0) — thiếu nó thì nhãn dài đẩy badge và
   công tắc dịch sang phải, hàng trông như đổi chiều rộng khi kéo/gạt. */
.form-layout-label {
    flex: 1 1 auto;
    min-width: 0;
}

/* Hai badge "Bắt buộc"/"Đang ẩn" xếp chồng lên cùng một ô lưới nên chỗ của chúng là hằng số;
   JS chỉ bật/tắt visibility, không xóa phần tử, vì vậy hàng không giật khi thao tác. */
.form-layout-flags {
    display: grid;
    justify-items: end;
}

.form-layout-flags > .badge {
    grid-area: 1 / 1;
}

.form-layout-pos {
    min-width: 1.5rem;
    text-align: right;
    font-size: .75rem;
    color: var(--bs-secondary-color);
    font-variant-numeric: tabular-nums;
}

[data-layout-drag] {
    cursor: grab;
}

/* jQuery UI sao chép class của ô đang kéo sang placeholder nên chỗ trống vẫn nằm đúng danh sách cột;
   phải bật lại visibility bằng !important vì widget gắn visibility:hidden trực tiếp lên phần tử. */
.form-layout-list > .ui-sortable-placeholder {
    visibility: visible !important;
}

.form-layout-list > .ui-sortable-placeholder::before {
    content: "";
    display: block;
    height: 2.75rem;
    border: 1px dashed var(--bs-border-color);
    border-radius: .375rem;
    background-color: var(--bs-primary-bg-subtle);
}

/* Header công khai (Landing + Auths). sticky thay vì fixed: ô menu vẫn chiếm chỗ trong luồng
   nên thân trang không phải đệm một khoảng bằng chiều cao header, và nền mờ + backdrop-filter
   của .app-navbar đã tự làm nội dung trôi bên dưới bị mờ đi. */
.public-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* Dưới 992px menu mở thành card nhiều dòng; đã ghim vào đỉnh thì phần card tràn quá viewport
   không cuộn tới được, nên chính card phải cuộn trong khung của nó. */
@media (max-width: 991.98px) {
    .public-navbar .navbar-collapse.show,
    .public-navbar .navbar-collapse.collapsing {
        max-height: calc(100vh - 4.75rem);
        overflow-y: auto;
    }
}