/* =====================================================
   SieuThiCloud v2 — Components dùng chung
   (button, badge, card, input, section...) — KHÔNG restyle ở page css
   ===================================================== */

/* =================== BUTTON =================== */
/* =================== SWITCH =================== */
.stc-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.stc-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.stc-switch__slider {
    position: absolute;
    inset: 0;
    background: var(--stc-neutral-300);
    border-radius: 99px;
    cursor: pointer;
    transition: background 0.18s ease;
}

.stc-switch__slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--stc-white);
    border-radius: 50%;
    transition: transform 0.18s ease;
    box-shadow: 0 1px 3px rgba(10, 26, 40, 0.25);
}

.stc-switch input:checked + .stc-switch__slider {
    background: var(--stc-primary);
}

.stc-switch input:checked + .stc-switch__slider::before {
    transform: translateX(18px);
}

.stc-switch input:focus-visible + .stc-switch__slider {
    box-shadow: 0 0 0 3px var(--stc-focus, rgba(39, 164, 242, 0.30));
}

.stc-switch input:disabled + .stc-switch__slider {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ===================== Popup xác nhận toàn cục (stcConfirm) — mẫu Uiverse trắng ===================== */
.stc-confirm {
    position: fixed;
    inset: 0;
    z-index: calc(var(--stc-z-modal, 910) + 10); /* 920: trên mọi modal (910), dưới toast (1000) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.stc-confirm[hidden] { display: none; }
.stc-confirm__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .45);
}
.stc-confirm__dialog {
    position: relative;
    width: 100%;
    max-width: 480px; /* sm:max-w-lg của mẫu */
    background: #fff;
    color: #111827;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);
    animation: stc-confirm-in .2s ease;
}
@keyframes stc-confirm-in {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to   { opacity: 1; transform: none; }
}
.stc-confirm__body {
    display: flex;
    align-items: flex-start;
    gap: 16px; /* sm:ml-4 */
    padding: 24px 24px 16px;
}
.stc-confirm__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; /* sm:h-10 sm:w-10 */
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fee2e2; /* bg-red-100 */
    color: #dc2626; /* text-red-600 */
}
.stc-confirm__icon svg { width: 22px; height: 22px; }
.stc-confirm__title {
    margin: 0 0 4px;
    font-size: 16px; /* text-base */
    font-weight: 600; /* font-semibold */
    line-height: 24px; /* leading-6 */
    color: #111827; /* text-gray-900 */
}
.stc-confirm__desc {
    margin: 0;
    font-size: 14px; /* text-sm */
    line-height: 20px;
    color: #6b7280; /* text-gray-500 */
}
.stc-confirm__foot {
    display: flex;
    justify-content: flex-end;
    gap: 12px; /* sm:ml-3 */
    padding: 12px 24px 20px;
    background: #f9fafb; /* bg-gray-50 */
    border-radius: 0 0 12px 12px;
}
/* Nút theo mẫu: Confirm (đỏ) phải — Cancel (trắng viền) trái */
.stc-confirm__ok {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #dc2626; /* bg-red-600 */
    box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
    cursor: pointer;
}
.stc-confirm__ok:hover { background: #ef4444; }
.stc-confirm__cancel {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    background: #fff;
    border: 1px solid #d1d5db; /* ring-gray-300 */
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
    cursor: pointer;
}
.stc-confirm__cancel:hover { background: #f9fafb; }
@media (max-width: 480px) {
    .stc-confirm__body { padding: 20px 16px 12px; flex-direction: column; text-align: center; }
    .stc-confirm__icon { width: 48px; height: 48px; margin: 0 auto; }
    .stc-confirm__foot { flex-direction: column-reverse; }
    .stc-confirm__ok, .stc-confirm__cancel { width: 100%; }
}

/* ===================== Buttons ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--stc-space-2);
    padding: 0 var(--stc-space-6);
    height: 44px;
    border-radius: var(--stc-radius-xs);
    font-size: var(--stc-text-base);
    font-weight: var(--stc-weight-semibold);
    border: 1px solid transparent;
    transition:
        background-color var(--stc-duration-fast) var(--stc-ease),
        border-color var(--stc-duration-fast) var(--stc-ease),
        box-shadow var(--stc-duration-fast) var(--stc-ease),
        color var(--stc-duration-fast) var(--stc-ease),
        transform var(--stc-duration-fast) var(--stc-ease);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation; /* bỏ double-tap zoom delay trên mobile */
}
.btn:disabled, .btn.is-disabled { opacity: 0.55; pointer-events: none; }

.btn--primary {
    background: var(--stc-gradient-primary);
    color: #fff;
    box-shadow: var(--stc-shadow-primary);
}
.btn--primary:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 12px 30px rgba(39, 164, 242, 0.45); }
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
    background: transparent;
    color: var(--stc-text-strong);
    border-color: var(--stc-border-strong);
}
.btn--ghost:hover { border-color: var(--stc-primary); color: var(--stc-primary-hover); background: var(--stc-primary-softer); }

.btn--soft {
    background: var(--stc-primary-soft);
    color: var(--stc-primary-hover);
}
.btn--soft:hover { background: var(--stc-primary-a15); }

.btn--lg { height: 52px; padding: 0 var(--stc-space-8); font-size: var(--stc-text-lg); }
.btn--sm { height: 36px; padding: 0 var(--stc-space-4); font-size: var(--stc-text-md); }

/* ---------- Loading state (chống spam submit) ---------- */
.btn.is-loading {
    pointer-events: none;
    color: transparent !important;          /* ẩn chữ, chỉ còn spinner + nền */
    position: relative;
}
.btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: btn-spin .7s linear infinite;
}
/* Nút nền sáng (outline/otp) → spinner màu chủ đạo */
.btn--ghost.is-loading::after,
.btn--outline.is-loading::after,
.btn--otp.is-loading::after {
    border-color: rgba(39, 164, 242, 0.25);
    border-top-color: var(--stc-primary);
}
/* Nút Gửi OTP: loading thu nhỏ vừa khít nút */
.btn--otp.is-loading::after {
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* Khóa mọi nút submit của form đang gửi (kể cả nút không phải .btn) */
button[disabled], input[type="submit"][disabled] { cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) {
    .btn.is-loading::after { animation-duration: 1.6s; }
}
.btn--block { width: 100%; }

/* =================== BADGE =================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-radius: var(--stc-radius-pill);
    font-size: var(--stc-text-xs);
    font-weight: var(--stc-weight-semibold);
    line-height: 1.6;
}
.badge--primary { background: var(--stc-primary-soft); color: var(--stc-primary-hover); }
.badge--success { background: var(--stc-success-soft); color: var(--stc-success); }
.badge--warning { background: var(--stc-warning-soft); color: var(--stc-warning); }
.badge--danger  { background: var(--stc-danger-soft);  color: var(--stc-danger); }

/* =================== CARD =================== */
.card {
    background: var(--stc-surface);
    border: 1px solid var(--stc-border);
    border-radius: var(--stc-radius-lg);
    box-shadow: var(--stc-shadow-xs);
}
.card--hover { transition: transform var(--stc-duration-normal) var(--stc-ease), box-shadow var(--stc-duration-normal) var(--stc-ease); }
.card--hover:hover { transform: translateY(-4px); box-shadow: var(--stc-shadow-md); }

/* =================== INPUT =================== */
.field { display: grid; gap: var(--stc-space-2); }
.field__label { font-size: var(--stc-text-md); font-weight: var(--stc-weight-medium); color: var(--stc-text-strong); }
.field__input {
    width: 100%;
    height: 44px;
    padding: 0 var(--stc-space-4);
    border: 1px solid var(--stc-border-strong);
    border-radius: var(--stc-radius-sm);
    background: var(--stc-surface);
    transition: border-color var(--stc-duration-fast) var(--stc-ease), box-shadow var(--stc-duration-fast) var(--stc-ease);
}
.field__input:focus-visible {
    outline: none;
    border-color: var(--stc-primary);
    box-shadow: 0 0 0 4px var(--stc-focus);
}
.field__hint { font-size: var(--stc-text-sm); color: var(--stc-text-muted); }
.field--error .field__input { border-color: var(--stc-danger); }

/* =================== SECTION =================== */
.section { padding-block: var(--stc-space-20); }
.section--tight { padding-block: var(--stc-space-12); }

.section__head { text-align: center; max-width: 640px; margin: 0 auto var(--stc-space-12); }
.section__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--stc-space-2);
    padding: 6px 16px;
    border-radius: var(--stc-radius-pill);
    background: var(--stc-primary-soft);
    color: var(--stc-primary-hover);
    font-size: var(--stc-text-sm);
    font-weight: var(--stc-weight-semibold);
    margin-bottom: var(--stc-space-4);
}
.section__title { margin-bottom: var(--stc-space-3); }
.section__desc { color: var(--stc-text-muted); font-size: var(--stc-text-lg); line-height: var(--stc-leading-relaxed); }

/* =================== ACCOUNT DROPDOWN (dropdown bám icon tài khoản) =================== */
.stc-acct {
    position: relative;
}

.stc-acct__menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 260px;
    padding: 6px;
    border-radius: 14px;
    background: var(--stc-surface, #fff);
    border: 1px solid var(--stc-border, #e5eaf1);
    box-shadow: var(--stc-shadow-lg, 0 16px 40px rgba(16, 42, 67, .16));
    z-index: calc(var(--stc-z-header, 100) + 2);
    animation: stcAcctIn .18s ease both;
}

@keyframes stcAcctIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Đầu dropdown: avatar + tên + email */
.stc-acct__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.stc-acct__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--stc-primary, #27a4f2), var(--stc-primary-600, #1683cc));
    flex-shrink: 0;
}

.stc-acct__who {
    min-width: 0;
}

.stc-acct__name {
    display: block;
    font-size: .92rem;
    font-weight: 700;
    color: var(--stc-text-strong, #10293f);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stc-acct__email {
    display: block;
    font-size: .76rem;
    color: var(--stc-text-muted, #8ba0b5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Số dư */
.stc-acct__balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 6px 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--stc-surface-2, #f0f6fc);
}

.stc-acct__balance-label {
    font-size: .8rem;
    color: var(--stc-text-muted, #62788f);
}

.stc-acct__balance-val {
    font-size: .95rem;
    font-weight: 800;
    color: var(--stc-primary, #27a4f2);
}

/* Các liên kết */
.stc-acct__links {
    display: grid;
    padding: 0 6px 6px;
}

.stc-acct__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--stc-text-2, #3f5a74);
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.stc-acct__link:hover {
    background: var(--stc-surface-2, #f0f6fc);
    color: var(--stc-primary, #27a4f2);
}

/* Link "Quản trị viên" (admin) — nổi bật tím */
.stc-acct__link--admin {
    color: #8134e8;
    background: rgba(146, 64, 240, 0.07);
}
.stc-acct__link--admin:hover {
    background: rgba(146, 64, 240, 0.14);
    color: #6d1fd1;
}

/* =================== ICON BUTTON (nút vuông icon cho header actions) =================== */
.stc-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--stc-border, #dbe4ee);
    color: var(--stc-text-2, #3f5a74);
    background: transparent;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

/* Nút tài khoản có dropdown: viền nổi bật hơn một chút */
.stc-acct__btn.stc-icon-btn {
    border-color: var(--stc-border-strong, #c4d3e2);
}

.stc-acct__btn.stc-icon-btn:hover {
    border-color: var(--stc-primary, #27a4f2);
}

.stc-icon-btn:hover {
    color: var(--stc-primary, #27a4f2);
    background: var(--stc-surface-2, #f0f6fc);
}

/* =================== LOGOUT BUTTON (nút tròn đỏ nở ra hiện chữ khi hover) ===================
   From Uiverse.io by vinodjangid07 — đặt trong .stc-header__actions */
.pf-logout-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition-duration: .3s;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.199);
    background-color: rgb(255, 65, 65);
    transition-property: width, border-radius; /* chỉ định property — không mặc định all */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.pf-logout-btn__sign {
    width: 100%;
    flex-shrink: 0;
    transition-duration: .3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pf-logout-btn__sign svg {
    width: 17px;
}

.pf-logout-btn__sign svg path {
    fill: #fff;
}

.pf-logout-btn__text {
    position: absolute;
    left: 36px; /* neo sau icon: 10px padding + 17px icon + 9px hở */
    width: 0%;
    opacity: 0;
    color: #fff;
    /* Đồng bộ cỡ chữ với nút btn--sm bên cạnh */
    font-size: var(--stc-text-md, .9375rem);
    font-weight: var(--stc-weight-semibold, 600);
    transition-duration: .3s;
    white-space: nowrap;
}

/* Hover: nở thành viên thuốc, hiện chữ */
.pf-logout-btn:hover {
    width: 130px;
    border-radius: 40px;
}

.pf-logout-btn:hover .pf-logout-btn__sign {
    width: 36px;
    justify-content: flex-start;
    padding-left: 10px;
}

.pf-logout-btn:hover .pf-logout-btn__text {
    opacity: 1;
    width: calc(100% - 39px);
}

/* Nhấn: lún nhẹ */
.pf-logout-btn:active {
    transform: translate(2px, 2px);
}

/* Màn hình nhỏ (<500px): toàn trang tắt hover — xem assets/css/no-hover-mobile.css */

/* =================== SUPPORT FLOAT (hỗ trợ nhanh nổi) =================== */
.support-float {
    position: fixed;
    right: var(--stc-space-5);
    bottom: var(--stc-space-5);
    z-index: var(--stc-z-header);
    display: grid;
    gap: var(--stc-space-2);
}

.support-float .support-action {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--stc-primary);
    color: #fff;
    box-shadow: var(--stc-shadow-md);
    overflow: visible;
    transition:
        filter var(--stc-duration-normal) var(--stc-ease),
        transform var(--stc-duration-normal) var(--stc-ease),
        box-shadow var(--stc-duration-normal) var(--stc-ease);
    will-change: transform;
}

/* Vòng sáng nhảy ra khi hover */
.support-float-colorful .support-action::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -5px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.78);
    transition:
        opacity var(--stc-duration-normal) var(--stc-ease),
        transform var(--stc-duration-normal) var(--stc-ease);
}

.support-float-colorful .support-action:hover,
.support-float-colorful .support-action:focus-visible {
    color: #fff;
    filter: saturate(1.12) brightness(1.05);
    box-shadow: 0 16px 34px rgba(10, 26, 40, 0.24);
    transform: translate(-5px, -4px) scale(1.08);
}

.support-float-colorful .support-action:hover::after,
.support-float-colorful .support-action:focus-visible::after {
    opacity: 1;
    transform: scale(1.16);
}

.support-float-colorful .support-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    transition: transform var(--stc-duration-normal) var(--stc-ease);
}

.support-float-colorful .support-action:hover .support-icon,
.support-float-colorful .support-action:focus-visible .support-icon {
    transform: rotate(-8deg) scale(1.08);
}

/* Nhãn hiện khi hover */
.support-float-colorful .support-label {
    position: absolute;
    top: 50%;
    right: calc(100% + var(--stc-space-3));
    display: grid;
    gap: 2px;
    min-width: max-content;
    padding: var(--stc-space-2) var(--stc-space-3);
    border: 1px solid var(--stc-border);
    border-radius: var(--stc-radius-md);
    background: var(--stc-surface);
    color: var(--stc-text-strong);
    box-shadow: var(--stc-shadow-md);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translate(8px, -50%);
    transition:
        opacity var(--stc-duration-fast) var(--stc-ease),
        transform var(--stc-duration-fast) var(--stc-ease),
        visibility var(--stc-duration-fast) var(--stc-ease);
}

.support-float-colorful .support-label b,
.support-float-colorful .support-label small {
    display: block;
    color: inherit;
    line-height: 1.25;
    white-space: nowrap;
}

.support-float-colorful .support-label small {
    color: var(--stc-text-muted);
    font-size: var(--stc-text-2xs);
}

.support-float-colorful .support-action:hover .support-label,
.support-float-colorful .support-action:focus-visible .support-label {
    opacity: 1;
    transform: translate(0, -50%);
    visibility: visible;
}

/* Màu riêng từng kênh */
.support-float-colorful .support-zalo { background: var(--stc-primary); }
.support-float-colorful .support-messenger { background: linear-gradient(135deg, #7c3aed, #2563eb 55%, #0ea5e9); }
.support-float-colorful .support-phone { background: var(--stc-success); }

.support-float-colorful .brand-text-icon {
    font-size: 10px;
    font-weight: var(--stc-weight-bold);
    letter-spacing: -0.02em;
}

@media (min-width: 721px) and (max-width: 1440px) {
    .support-float-colorful .support-action,
    .support-float-colorful .support-icon { flex-basis: 40px; width: 40px; height: 40px; }
}

@media (max-width: 720px) {
    .support-float-colorful .support-label { display: none; }
    .support-float { right: 14px; bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .support-float-colorful .support-action,
    .support-float-colorful .support-action::after,
    .support-float-colorful .support-icon { transition-duration: 1ms; }
}

/* =================== ALERT =================== */
.alert {
    display: flex;
    gap: var(--stc-space-3);
    padding: var(--stc-space-4) var(--stc-space-5);
    border-radius: var(--stc-radius-sm);
    font-size: var(--stc-text-md);
    border: 1px solid transparent;
}
.alert--success { background: var(--stc-success-soft); color: var(--stc-success); border-color: rgba(22,163,74,.2); }
.alert--danger  { background: var(--stc-danger-soft);  color: var(--stc-danger);  border-color: rgba(220,38,38,.2); }
.alert--info    { background: var(--stc-info-soft);    color: var(--stc-primary-hover); border-color: var(--stc-primary-a25); }

/* =================== TOAST (thông báo nổi toàn cục) =================== */
.toast-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}
@media (max-width: 560px) {
    .toast-stack {
        top: 10px;
        right: 10px;
        left: 10px;
        align-items: flex-end; /* toast bám cạnh phải, không lệch vào giữa */
    }
    /* Scale gọn: vừa khít màn nhỏ, không tràn, không lệch */
    .toast {
        width: 100%;
        max-width: 340px;
        min-height: 0;
        padding: 8px 12px;
        gap: 10px;
        transform: translateY(-16px);
    }
    .toast.is-visible { transform: translateY(0); }
    .toast.is-leaving { transform: translateY(-16px); }
    .toast__icon { width: 28px; height: 28px; }
    .toast__icon svg { width: 14px; height: 14px; }
    .toast__title { font-size: 12.5px; }
    .toast__text { font-size: 11.5px; }
    .toast__close { width: 14px; height: 14px; }
    .toast__close svg { width: 14px; height: 14px; }
}

.toast {
    --toast-accent: var(--stc-success);
    --toast-accent-soft: rgba(4, 228, 0, 0.23);
    width: 330px;
    max-width: calc(100vw - 32px);
    min-height: 80px;
    border-radius: 8px;
    box-sizing: border-box;
    padding: 10px 15px;
    background-color: #ffffff;
    box-shadow: rgba(149, 157, 165, 0.2) 0 8px 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 15px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity .25s ease, transform .25s ease;
}
.toast.is-visible { opacity: 1; transform: translateX(0); }
.toast.is-leaving { opacity: 0; transform: translateX(24px); }

.toast--error   { --toast-accent: var(--stc-danger);  --toast-accent-soft: rgba(220, 38, 38, 0.16); }
.toast--info    { --toast-accent: var(--stc-primary); --toast-accent-soft: rgba(39, 164, 242, 0.2); }
.toast--warning { --toast-accent: #d97706;            --toast-accent-soft: rgba(217, 119, 6, 0.18); }

.toast__wave {
    position: absolute;
    transform: rotate(90deg);
    left: -31px;
    top: 32px;
    width: 80px;
    fill: var(--toast-accent-soft);
}
.toast__icon {
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--toast-accent-soft);
    border-radius: 50%;
    margin-left: 8px;
}
.toast__icon svg { width: 17px; height: 17px; color: var(--toast-accent); }
.toast__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    flex-grow: 1;
    min-width: 0;
}
.toast__title {
    margin: 0;
    color: var(--toast-accent);
    font-size: 15px;
    font-weight: 700;
    cursor: default;
    overflow-wrap: anywhere;
}
.toast__text {
    margin: 0;
    font-size: 13px;
    color: #555;
    cursor: default;
    overflow-wrap: anywhere;
}
.toast__close {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin-right: 4px;
    border: 0;
    background: none;
    padding: 0;
    color: #555;
    cursor: pointer;
}
.toast__close:hover { color: #222; }
.toast__close svg { width: 18px; height: 18px; display: block; }
@media (prefers-reduced-motion: reduce) {
    .toast { transition: none; transform: none; }
}

/* =================== POPUP TOÀN CỤC (pf-modal 3 phần) ===================
   Cấu trúc: HEAD cố định (icon + tên + nút ×) · BODY cuộn khi dài · FOOTER nút bấm.
   Markup chuẩn:
   <div class="pf-overlay" id="..." hidden>
       <div class="pf-modal" role="dialog" aria-modal="true" aria-labelledby="...-title">
           <header class="pf-modal__head">
               <span class="pf-modal__icon">SVG</span>
               <h2 class="pf-modal__title" id="...-title">Tên popup</h2>
               <button type="button" class="pf-modal__close" data-popup-close aria-label="Đóng">&times;</button>
           </header>
           <div class="pf-modal__body">
               ... nội dung dài (form, bảng...) — tự có thanh cuộn ...
           </div>
           <footer class="pf-modal__foot">
               <button class="btn btn--primary" type="submit" form="form-id">Lưu</button>
               <button class="btn btn--ghost" type="button" data-popup-close>Hủy</button>
           </footer>
       </div>
   </div>
   Mở: [data-popup-open="#id"] · Đóng: [data-popup-close], backdrop, Esc */
.pf-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 18, 34, .55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: pfOverlayIn .18s ease;
    overscroll-behavior: contain; /* cuộn trong modal không xuyên xuống nền */
}

.pf-overlay[hidden] {
    display: none;
}

@keyframes pfOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.pf-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: min(690px, 100%); /* mọi popup ngang tối thiểu 690px, không tràn viewport hẹp */
    max-width: 690px;
    max-height: min(680px, calc(100dvh - 40px));
    overflow: hidden;
    border-radius: 18px;
    background: var(--surface-1, #fff);
    border: 1px solid var(--border, #e5eaf1);
    box-shadow: 0 24px 64px rgba(8, 18, 34, .28);
    animation: pfPopupIn .2s cubic-bezier(.2, .9, .3, 1.2);
}

@keyframes pfPopupIn {
    from { transform: translateY(14px) scale(.97); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

/* ----- HEAD: icon + tên + nút đóng (cố định, nền xanh chữ trắng) ----- */
.pf-modal__head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 14px 18px;
    border-bottom: none;
    color: #fff;
    background: var(--stc-gradient-primary, linear-gradient(135deg, #27a4f2, #1b7fd4));
}

.pf-modal__icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #fff;
    background: rgba(255, 255, 255, .18);
}

.pf-modal__icon svg {
    display: block;
}

.pf-modal__title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
}

.pf-modal__close {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

.pf-modal__close:hover {
    background: rgba(255, 255, 255, .34);
    color: #fff;
    transform: rotate(90deg);
}

/* ----- BODY: nội dung, cuộn khi dài ----- */
.pf-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 18px;
}

.pf-modal__body::-webkit-scrollbar {
    width: 8px;
}

.pf-modal__body::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(81, 99, 122, .35);
}

.pf-modal__desc {
    margin: 0 0 16px;
    font-size: 13.5px;
    color: var(--text-2, #5a6b7f);
}

/* ----- FOOTER: TOÀN BỘ nút căn phải (cố định) ----- */
.pf-modal__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* mọi nút đẩy về phải */
    gap: 10px;
    flex-shrink: 0;
    padding: 14px 18px;
    border-top: 1px solid var(--border, #e5eaf1);
    background: var(--surface-1, #fff);
}

/* Hàng nút bên trong pf-modal__foot (khi JS bọc nút trong div trung gian) */
.pf-modal__foot-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; width: 100%; }

/* =================== FIELD CHUẨN HỆ THỐNG (pf-field) ===================
   Ô bọc viền chứa input/icon — input toàn cục dùng chung mọi form + popup.
   <label class="pf-label" for="id">Tên</label>
   <div class="pf-field"> [icon?] <input id="id" ...> </div> */
.pf-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-1, #10293f);
    margin-bottom: 6px;
    margin-top: 14px;
}

.pf-form > .pf-label:first-of-type,
.pf-modal__body > .pf-form > .pf-label:first-of-type {
    margin-top: 0;
}

.pf-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-radius: var(--radius-md, 12px);
    border: 1.5px solid var(--border, #dde5ee);
    background: var(--surface-1, #fff);
    transition: border-color .2s ease, box-shadow .2s ease;
    margin-bottom: 4px;
}

.pf-field:focus-within {
    border-color: var(--primary, #27a4f2);
    box-shadow: 0 0 0 3px rgba(39, 164, 242, .15);
}

.pf-field--static {
    background: var(--surface-2, #f5f8fb);
    border-style: dashed;
}

.pf-field__icon {
    color: var(--text-3, #8ba0b5);
    flex-shrink: 0;
}

.pf-field input,
.pf-field select {
    flex: 1;
    width: 100%;      /* đè width mặc định theo attribute size — không tràn container */
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 8px 0;
    font-size: 1rem;  /* >=16px: iOS Safari không tự zoom khi focus */
    color: var(--text-1, #10293f);
    font-family: inherit;
}

/* Select trong .pf-field: bỏ giao diện native, mũi tên tùy chỉnh bên phải */
.pf-field select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 22px;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238ba0b5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
}

.pf-field select option {
    background: var(--surface-1, #fff);
    color: var(--text-1, #10293f);
}

/* Alert mô tả chức năng — đầu body popup (From Uiverse.io by kennyotsu) */
.notifications-container {
    width: 100%;
    height: auto;
    margin-bottom: 1rem; /* tách khỏi form/ nội dung bên dưới */
    font-size: .875rem;
    line-height: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notifications-container .flex {
    display: flex;
}

.notifications-container .flex-shrink-0 {
    flex-shrink: 0;
}

.notifications-container .alert {
    background-color: rgb(254 252 232);
    border-left-width: 4px;
    border-color: rgb(250 204 21);
    border-radius: .375rem;
    padding: 1rem;
}

.notifications-container .alert-svg {
    height: 1.25rem;
    width: 1.25rem;
    color: rgb(250 204 21);
}

.notifications-container .alert-prompt-wrap {
    margin-left: .75rem;
    color: rgb(202 138 4);
}

.notifications-container .alert-prompt-link {
    font-weight: 500;
    color: rgb(141, 56, 0);
    text-decoration: underline;
}

.notifications-container .alert-prompt-link:hover {
    color: rgb(202, 138, 4);
}

.pf-field input:disabled {
    color: var(--text-2, #51637a);
    cursor: not-allowed;
}

/* Dòng OTP trong popup */
.vp-otp-line {
    display: flex;
    gap: 10px;
}

/* Nút Gửi OTP nằm cùng hàng input trong .pf-field — đẩy sát phải, không co */
.pf-field .btn {
    flex: none;
    white-space: nowrap;
}

/* Nút Gửi OTP — outline chủ đạo + hiệu ứng hover/active riêng */
.btn--otp {
    height: 38px;
    padding: 0 16px;
    font-size: 13.5px;
    background: var(--stc-primary-soft, #e8f5fe);
    color: var(--stc-primary-hover, #0f8ae0);
    border: 1.5px solid rgba(39, 164, 242, .45);
    position: relative;
    overflow: hidden;
}
.btn--otp::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
    transform: translateX(-100%);
    transition: transform .5s ease;
}
.btn--otp:hover:not(:disabled) {
    background: var(--stc-gradient-primary, linear-gradient(90deg, #27a4f2, #0f8ae0));
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(39, 164, 242, .35);
}
.btn--otp:hover:not(:disabled)::before {
    transform: translateX(100%);
}
.btn--otp:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(39, 164, 242, .25);
}
.btn--otp:disabled {
    background: var(--stc-surface-2, #f5f8fb);
    color: var(--stc-text-3, #8ba0b5);
    border-color: var(--stc-border, #dde5ee);
}

.vp-otp-line input {
    letter-spacing: 4px;
    font-weight: 700;
}

.vp-otp-line .btn {
    flex: none;
    white-space: nowrap;
}

.vp-otp-status {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--text-2, #5a6b7f);
}

/* Nút mắt ẩn/hiện mật khẩu — TOÀN CỤC (password-toggle.js tự chèn vào .pf-field / .group) */
.pw-toggle {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-3, #8ba0b5);
    cursor: pointer;
    flex-shrink: 0;
    transition: color .2s ease, background .2s ease;
}

.pw-toggle:hover {
    color: var(--primary, #27a4f2);
    background: rgba(39, 164, 242, .1);
}

.pw-toggle:focus-visible {
    outline: 2px solid var(--stc-primary, #27a4f2);
    outline-offset: 1px;
}

/* Ô pf-field có nút mắt: input chừa lề phải cho nút */
.pf-field:has(.pw-toggle) input {
    padding-right: 0;
    margin-right: 2px;
}

/* Admin field (cột): icon ngữ nghĩa bên trái mọi input + mắt góc phải ô password */
.adm-field,
.adm-sec__field {
    position: relative;
}
/* Wrapper ô input (input-icon.js tự bọc): neo icon/mắt đúng theo ô input,
   không trôi theo <small> hint nằm sau ô */
.adm-field .pf-inputwrap,
.adm-sec__field .pf-inputwrap {
    position: relative;
    display: block;
}
.adm-field > .pf-field__icon,
.adm-sec__field > .pf-field__icon {
    position: absolute;
    left: 10px;
    bottom: 12px;
    pointer-events: none;
    color: var(--text-3, #8ba0b5);
}
.pf-inputwrap > .pf-field__icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-3, #8ba0b5);
}
.adm-field:has(.pf-field__icon) input,
.adm-sec__field:has(.pf-field__icon) input {
    padding-left: 2.4rem;
}
.adm-field:has(.pw-toggle) input,
.adm-sec__field:has(.pw-toggle) input {
    padding-right: 2.6rem;
}
.adm-field > .pw-toggle,
.adm-sec__field > .pw-toggle {
    position: absolute;
    right: 6px;
    bottom: 3px;
}
.pf-inputwrap > .pw-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

@media (max-width: 480px) {
    .vp-otp-line {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pf-overlay, .pf-modal { animation: none; }
    .pf-modal__close { transition: none; }
}

/* Màn hẹp dưới 750px: không đủ chỗ cho sàn 690px + padding → popup chiếm hết ngang */
@media (max-width: 749px) {
    .pf-modal { min-width: 0; }
}

@media (max-width: 480px) {
    .pf-overlay {
        padding: 12px;
    }

    .pf-modal {
        min-width: 0;   /* màn nhỏ: popup chiếm hết chiều ngang, bỏ sàn 690px */
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - 24px);
        border-radius: 14px;
    }

    .pf-modal__head {
        padding: 12px 14px;
    }

    .pf-modal__body {
        padding: 16px 14px;
    }

    .pf-modal__foot {
        padding: 12px 14px;
    }
}

/* ========== Footer bảng dùng chung: phân trang + chọn số dòng (helper pager_footer) ========== */
/* Grid 3 cột: pager căn giữa tuyệt đối theo card, select size neo sát phải */
.tbl-foot {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px 16px;
    padding: 12px 16px;
    border-top: 1px solid var(--stc-border-soft, #eef1f6);
    background: var(--stc-surface);
}
.tbl-foot__pager {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}
.tbl-foot__link {
    display: grid;
    place-items: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 8px;
    font-size: .84rem;
    font-weight: var(--stc-weight-semibold, 600);
    color: var(--stc-text);
    text-decoration: none;
    background: var(--stc-surface-2, #f2f5fa);
}
.tbl-foot__link:hover { background: var(--stc-surface-3, #e6edf7); }
.tbl-foot__link.is-active {
    background: var(--stc-gradient-primary, linear-gradient(135deg, #27a4f2, #1462b8));
    color: #fff;
    pointer-events: none;
}
.tbl-foot__link.is-disabled {
    opacity: .4;
    pointer-events: none;
}
.tbl-foot__size {
    grid-column: 3;
    justify-self: end;
    display: inline-flex;
    align-items: center;
    font-size: .82rem;
    color: var(--stc-text-muted);
}
/* Select compact: viền + bo góc, chỉ số + mũi tên xổ */
.tbl-foot__size select {
    appearance: none;
    -webkit-appearance: none;
    height: 32px;
    padding: 0 14px 0 8px;
    border: 1px solid var(--stc-border);
    border-radius: 8px;
    background-color: var(--stc-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 2px center;
    color: var(--stc-text);
    font-size: .84rem;
    font-weight: var(--stc-weight-semibold, 600);
    font-family: inherit;
    cursor: pointer;
}
.tbl-foot__size select:hover { color: var(--stc-primary, #27a4f2); }
.tbl-foot__size select:focus {
    outline: none;
    color: var(--stc-primary, #27a4f2);
    border-color: var(--stc-primary-a40, rgba(39, 164, 242, .4));
    box-shadow: 0 0 0 3px var(--stc-primary-a10, rgba(39, 164, 242, .1));
}
@media (max-width: 640px) {
    /* Mobile: pager + size xuống dòng riêng, cả hai căn giữa */
    .tbl-foot {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .tbl-foot__pager { grid-column: 1; }
    .tbl-foot__size { grid-column: 1; justify-self: center; }
}
