/* =============================================================================
   Nền chung trang đăng nhập / đăng ký từ mẫu 3 trở đi (views/panel/auth/kit).
   Mọi thứ đọc từ biến --au-*: mỗi mẫu (/assets/auth/themes/N.css) đặt lại biến trên
   body.au-tN và tự viết phần bố cục / minh hoạ riêng. Class chung prefix au-, class
   riêng của mẫu dùng prefix khác — không viết selector element trần ngoài body.
   ============================================================================= */

.au {
    --au-font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --au-bg: #f8fafc;
    --au-ink: #0f172a;
    --au-muted: #64748b;
    --au-label: var(--au-ink);
    --au-soft: #f1f5f9;

    --au-input-h: 48px;
    --au-input-bg: #fff;
    --au-input-ink: var(--au-ink);
    --au-input-bw: 1.5px;
    --au-input-border: #e2e8f0;
    --au-input-border-hover: #cbd5e1;
    --au-input-focus: #4f46e5;
    --au-autofill: #eef2ff;
    --au-ring: rgba(79, 70, 229, .16);
    --au-placeholder: #94a3b8;
    --au-ic: #94a3b8;
    --au-radius: 12px;
    --au-gap: 16px;

    --au-primary: #4f46e5;
    --au-primary-ink: #fff;
    --au-btn-bg: var(--au-primary);
    --au-btn-h: 50px;
    --au-btn-radius: var(--au-radius);
    --au-btn-border: 0;
    --au-btn-shadow: none;
    --au-link: var(--au-primary);

    --au-tabs-bg: var(--au-soft);
    --au-tabs-ink: var(--au-muted);
    --au-tabs-active-bg: #fff;
    --au-tabs-active-ink: var(--au-ink);
    --au-tabs-active-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 2px 8px -2px rgba(15, 23, 42, .08);

    --au-pop-bg: #fff;
    --au-pop-ink: #334155;
    --au-pop-border: #e2e8f0;
    --au-danger: #e11d48;
    --au-ok: #16a34a;
}

.au,
.au *,
.au *::before,
.au *::after { box-sizing: border-box; }

body.au {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--au-bg);
    color: var(--au-ink);
    font-family: var(--au-font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body.au-modal-open { overflow: hidden; }

.au-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Thương hiệu ---------- */
.au-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: inherit;
    font-weight: 700;
    text-decoration: none;
}
.au-brand__logo {
    display: block;
    width: auto;
    max-width: 180px;
    max-height: 40px;
    object-fit: contain;
}
.au-brand__mark {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--au-primary);
    color: var(--au-primary-ink);
    font-size: 17px;
    font-weight: 800;
    line-height: 1;
}
.au-brand__name {
    overflow: hidden;
    font-size: 16px;
    letter-spacing: -.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Chuyển Đăng nhập / Đăng ký ---------- */
.au-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border-radius: calc(var(--au-radius) + 4px);
    background: var(--au-tabs-bg);
}
.au-tabs__item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border-radius: var(--au-radius);
    color: var(--au-tabs-ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color .15s, background .15s, box-shadow .15s;
}
.au-tabs__item:hover { color: var(--au-tabs-active-ink); }
.au-tabs__item.is-active {
    background: var(--au-tabs-active-bg);
    color: var(--au-tabs-active-ink);
    box-shadow: var(--au-tabs-active-shadow);
}

/* ---------- Form ---------- */
.au-form {
    display: flex;
    flex-direction: column;
    gap: var(--au-gap);
    margin: 0;
}
.au-field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.au-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.au-label {
    color: var(--au-label);
    font-size: 13.5px;
    font-weight: 600;
}
.au-optional {
    color: var(--au-muted);
    font-weight: 400;
}

.au-control {
    position: relative;
    display: flex;
    align-items: center;
}
.au-control__ic {
    position: absolute;
    left: 15px;
    width: 18px;
    height: 18px;
    color: var(--au-ic);
    pointer-events: none;
    transition: color .15s;
}
.au-input {
    width: 100%;
    height: var(--au-input-h);
    margin: 0;
    padding: 0 16px 0 44px;
    border: var(--au-input-bw) solid var(--au-input-border);
    border-radius: var(--au-radius);
    outline: none;
    background: var(--au-input-bg);
    color: var(--au-input-ink);
    font: inherit;
    font-size: 15px;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.au-input::placeholder { color: var(--au-placeholder); opacity: 1; }
.au-input:hover { border-color: var(--au-input-border-hover); }
.au-input:focus {
    border-color: var(--au-input-focus);
    box-shadow: 0 0 0 4px var(--au-ring);
}
.au-control:focus-within .au-control__ic { color: var(--au-input-focus); }
.au-control:has(.au-eye) .au-input { padding-right: 50px; }
.au-control.is-locked .au-input { opacity: .7; cursor: not-allowed; }

/* Autofill của trình duyệt: giữ màu nền theo mẫu (nhất là mẫu nền tối) */
.au-input:-webkit-autofill {
    -webkit-text-fill-color: var(--au-input-ink);
    -webkit-box-shadow: 0 0 0 100px var(--au-autofill) inset;
    caret-color: var(--au-input-ink);
    transition: background-color 99999s;
}
.au-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 100px var(--au-autofill) inset, 0 0 0 4px var(--au-ring);
}

.au-eye {
    position: absolute;
    right: 6px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: calc(var(--au-radius) - 4px);
    background: transparent;
    color: var(--au-ic);
    cursor: pointer;
    transition: color .15s;
}
.au-eye:hover { color: var(--au-input-ink); }
.au-eye:focus-visible { outline: 2px solid var(--au-input-focus); outline-offset: -2px; }
.au-eye svg { width: 18px; height: 18px; }

/* ---------- Nút ---------- */
.au-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: var(--au-btn-h);
    margin-top: 4px;
    padding: 0 22px;
    border: var(--au-btn-border);
    border-radius: var(--au-btn-radius);
    background: var(--au-btn-bg);
    color: var(--au-primary-ink);
    font: inherit;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: .005em;
    cursor: pointer;
    box-shadow: var(--au-btn-shadow);
    transition: transform .15s, box-shadow .15s, filter .15s, background .15s;
}
.au-btn svg { width: 18px; height: 18px; transition: transform .2s; }
.au-btn:hover { filter: brightness(1.06); }
.au-btn:hover svg { transform: translateX(3px); }
.au-btn:active { transform: translateY(1px); }
.au-btn:focus-visible { outline: 3px solid var(--au-input-focus); outline-offset: 3px; }
.au-btn:disabled { opacity: .6; cursor: not-allowed; filter: none; transform: none; }
.au-btn:disabled svg { display: none; }

.au-chip-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 12px;
    border: 1px dashed var(--au-input-border-hover);
    border-radius: 999px;
    background: transparent;
    color: var(--au-link);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.au-chip-btn:hover { background: var(--au-soft); }
.au .generate_email_waring { font-size: 12.5px; }

/* ---------- Chữ phụ / link ---------- */
.au-link {
    color: var(--au-link);
    font-weight: 600;
    text-decoration: none;
}
.au-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.au-link--sm { font-size: 13px; }

.au-switch {
    margin: 2px 0 0;
    color: var(--au-muted);
    font-size: 14px;
    text-align: center;
}
.au-try {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--au-radius);
    background: var(--au-soft);
    color: var(--au-muted);
    font-size: 13.5px;
    text-align: center;
}
.au-try svg { flex: none; width: 16px; height: 16px; color: var(--au-link); }

/* ---------- Yêu cầu mật khẩu (password_requirement.ejs + check_password_register.js) ---------- */
.au-field--pw .check-password {
    display: none;
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--au-pop-border);
    border-radius: var(--au-radius);
    background: var(--au-pop-bg);
    color: var(--au-pop-ink);
    font-size: 13px;
    box-shadow: 0 18px 40px -12px rgba(15, 23, 42, .28);
}
.au-field--pw .check-password.active { display: block; }
.au-field--pw .check-password > div:first-child { margin-bottom: 6px; font-weight: 700; }
.au .check-password-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 3px 0;
}
.au .check-password-item::before {
    content: "";
    flex: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--au-pop-border);
    border-radius: 50%;
}
.au .check-password-item.valid { color: var(--au-ok); }
.au .check-password-item.valid::before {
    border-color: var(--au-ok);
    background: var(--au-ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round' d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 10px no-repeat;
}

.au .re-check-password {
    display: none;
    color: var(--au-danger);
    font-size: 13px;
    font-weight: 500;
}
.au .re-check-password.active { display: block; }

/* ---------- Captcha + điều khoản ---------- */
.au .area-captcha {
    display: flex;
    justify-content: center;
    min-height: 78px;
}

.au-check {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--au-muted);
    font-size: 13.5px;
    line-height: 1.45;
    cursor: pointer;
}
.au-check input {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    opacity: 0;
}
.au-check__box {
    flex: none;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--au-input-border-hover);
    border-radius: 6px;
    background: var(--au-input-bg);
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.au-check__box svg {
    width: 13px;
    height: 13px;
    color: var(--au-primary-ink);
    opacity: 0;
    transform: scale(.6);
    transition: opacity .15s, transform .15s;
}
.au-check input:checked + .au-check__box { border-color: var(--au-primary); background: var(--au-primary); }
.au-check input:checked + .au-check__box svg { opacity: 1; transform: none; }
.au-check input:focus-visible + .au-check__box { box-shadow: 0 0 0 4px var(--au-ring); }

/* ---------- Modal OTP (otp_modal.ejs, không có Bootstrap) ---------- */
.au #modalOTP {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.au #modalOTP.show { opacity: 1; visibility: visible; }
.au #modalOTP .modal-dialog {
    width: 100%;
    max-width: 400px;
    margin: 0;
    transform: translateY(12px) scale(.98);
    transition: transform .2s;
}
.au #modalOTP.show .modal-dialog { transform: none; }
.au #modalOTP .modal-content {
    overflow: hidden;
    border-radius: 20px;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 30px 60px -12px rgba(15, 23, 42, .35);
}
.au #modalOTP .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 0 24px;
}
.au #modalOTP .modal-title { margin: 0; font-size: 17px; font-weight: 700; }
.au #modalOTP .close {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.au #modalOTP .close::before { content: "\00d7"; }
.au #modalOTP .modal-body { padding: 18px 24px 26px; text-align: center; }
.au #modalOTP .otp-label { color: #475569; font-size: 15px; }
.au #modalOTP #otp { font-family: inherit; letter-spacing: .3em; }
.au #modalOTP .btn-confirm-otp {
    height: 44px;
    margin-top: 6px;
    padding: 0 28px;
    border: 0;
    border-radius: 12px;
    background: var(--au-primary);
    color: var(--au-primary-ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

/* ---------- Chọn ngôn ngữ ---------- */
.au .lang-picker-row { padding: 0; }

@media (prefers-reduced-motion: reduce) {
    .au *,
    .au *::before,
    .au *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
