@font-face {
    font-family: "Noto Sans Thai Local";
    src: url("../fonts/NotoSansThai-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Noto Sans Thai Local";
    src: url("../fonts/NotoSansThai-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --login-navy-950: #10183f;
    --login-navy-900: #192459;
    --login-navy-800: #24356f;
    --login-navy-700: #385087;
    --login-ink: #17213f;
    --login-ink-soft: #4b5875;
    --login-muted: #65718b;
    --login-sky-400: #8fb9e4;
    --login-sky-300: #a9c9e8;
    --login-sky-200: #cbdff2;
    --login-sky-100: #e8f1fa;
    --login-sky-50: #f4f8fd;
    --login-lavender: #bd82d2;
    --login-gold: #f2b232;
    --login-white: #ffffff;
    --login-line: #dbe4f0;
    --login-line-strong: #bdcce0;
    --login-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

body.mi-login-body {
    position: relative;
    isolation: isolate;
    min-height: 100svh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    overflow-x: hidden;
    padding: 42px 20px;
    color: var(--login-ink);
    background:
        radial-gradient(circle at 16% 14%, rgb(143 185 228 / 0.22), transparent 28%),
        radial-gradient(circle at 88% 86%, rgb(189 130 210 / 0.17), transparent 30%),
        var(--login-navy-900);
    background-size: auto;
    font-family: "Noto Sans Thai Local", "Leelawadee UI", Tahoma, system-ui, sans-serif;
}

body.mi-login-body::before,
body.mi-login-body::after {
    content: "";
    position: fixed;
    z-index: -1;
    width: 440px;
    height: 440px;
    border: 1px solid rgb(169 201 232 / 0.18);
    border-radius: 50%;
    pointer-events: none;
}

body.mi-login-body::before {
    top: -265px;
    left: -195px;
    box-shadow: inset 0 0 0 68px rgb(143 185 228 / 0.04), inset 0 0 0 136px rgb(189 130 210 / 0.03);
}

body.mi-login-body::after {
    right: -225px;
    bottom: -290px;
    box-shadow: inset 0 0 0 76px rgb(189 130 210 / 0.04), inset 0 0 0 150px rgb(143 185 228 / 0.03);
}

.login-shell.login-shell--focused {
    position: relative;
    width: min(100%, 450px);
    max-width: 450px;
    margin: 0 auto;
}

body.mi-register-body .login-shell,
body.mi-register-body .login-shell.login-shell--focused,
body.mi-register-body .login-shell.login-shell--register {
    width: min(100%, 880px) !important;
    max-width: 880px !important;
    display: block !important;
}

body.mi-register-body .login-panel {
    padding: 42px 40px 34px;
}

body.mi-legal-body {
    place-items: start center;
    padding-top: 42px;
    padding-bottom: 56px;
}

body.mi-legal-body .login-shell.login-shell--focused {
    width: min(100%, 760px);
    max-width: 760px;
}

.login-shell.login-shell--focused::before,
.login-shell.login-shell--register::before,
body.mi-register-body .login-shell::before,
body.mi-legal-body .login-shell::before {
    content: none;
    display: none;
}

.login-panel {
    width: 100%;
    padding: 38px 36px 30px;
    border: 0;
    border-radius: 16px;
    background: var(--login-white);
    box-shadow: 0 8px 8px rgb(4 9 31 / 0.24);
}

.login-logo.login-logo--panel {
    width: auto;
    max-width: 152px;
    max-height: 62px;
    margin: 0 auto 18px;
    filter: none;
    transition: none;
}

.login-logo.login-logo--panel:hover { transform: none; }

.login-panel__header { gap: 5px; margin-bottom: 24px; }

.login-panel__header h1 {
    color: var(--login-navy-950);
    font-size: 1.62rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.login-panel__header p { color: var(--login-muted); font-size: 0.88rem; font-weight: 400; }

.login-oauth-row { gap: 10px !important; margin-bottom: 21px !important; }

.login-oauth-row .mi-button,
.login-line,
.login-google {
    min-height: 47px !important;
    height: 47px !important;
    border-radius: 9px !important;
    font-size: 0.9rem !important;
    box-shadow: none !important;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms var(--login-ease) !important;
}

.login-line { border-width: 1px !important; }
.login-line:hover { transform: translateY(-1px) !important; box-shadow: none !important; }
.login-line:active { transform: translateY(0) !important; box-shadow: none !important; }

.login-google {
    border: 1px solid var(--login-line-strong) !important;
    color: var(--login-ink) !important;
    background: var(--login-white) !important;
}

.login-google:hover {
    border-color: var(--login-sky-400) !important;
    color: var(--login-navy-900) !important;
    background: var(--login-sky-50) !important;
    transform: translateY(-1px) !important;
    box-shadow: none !important;
}

.login-google:active { transform: translateY(0) !important; box-shadow: none !important; }

.login-divider { margin-bottom: 19px; color: var(--login-muted); font-size: 0.77rem; font-weight: 400; }
.login-divider::before,
.login-divider::after { background: var(--login-line); }

.login-form { gap: 13px; }

body.mi-register-body .login-form {
    grid-template-columns: 1fr 1fr;
}

body.mi-register-body .login-form > input[type="hidden"] {
    display: none;
}

body.mi-register-body .register-consent,
body.mi-register-body .login-submit {
    grid-column: 1 / -1;
}

.login-input-wrap .mi-icon { color: var(--login-muted); }

.login-input-wrap .mi-input {
    min-height: 49px;
    border: 1px solid var(--login-line-strong);
    border-radius: 9px;
    color: var(--login-ink);
    background: var(--login-sky-50);
    font-weight: 400;
    box-shadow: none;
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.login-input-wrap .mi-input::placeholder { color: var(--login-muted); opacity: 1; }

.login-input-wrap .mi-input:hover { border-color: var(--login-sky-400); }

.login-input-wrap .mi-input:focus {
    border-color: var(--login-navy-700);
    color: var(--login-ink);
    background: var(--login-white);
    box-shadow: 0 0 0 3px rgb(143 185 228 / 0.28);
}

.login-input-wrap:focus-within .mi-icon { color: var(--login-navy-700); }

.login-password-toggle {
    min-height: 34px;
    border-radius: 7px;
    color: var(--login-muted);
    transition: color 150ms ease, background-color 150ms ease;
}

.login-password-toggle:hover { color: var(--login-navy-900); background: var(--login-sky-100); }

.register-consent {
    margin-top: 2px;
    color: var(--login-ink-soft);
    font-size: 0.84rem;
    font-weight: 400;
    line-height: 1.55;
}

.register-consent input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--login-navy-900);
}

.register-consent a {
    color: var(--login-navy-700);
    font-weight: 700;
}

.register-consent a:hover { color: var(--login-navy-900); }

.login-submit {
    min-height: 49px;
    margin-top: 3px;
    border: 1px solid var(--login-navy-900);
    border-radius: 9px;
    color: var(--login-white);
    background: var(--login-navy-900);
    box-shadow: none;
    font-size: 0.96rem;
    transition: background-color 180ms ease, border-color 180ms ease, transform 180ms var(--login-ease);
}

.login-submit:hover {
    border-color: var(--login-navy-800);
    background: var(--login-navy-800);
    transform: translateY(-1px);
    box-shadow: none;
}

.login-submit:active { transform: translateY(0); box-shadow: none; }
.login-submit:disabled { background: var(--login-navy-700); opacity: 0.78; }

.login-switch { margin-top: 21px; color: var(--login-muted); font-size: 0.88rem; font-weight: 400; }
.login-switch a { color: var(--login-navy-700); }
.login-switch a:hover { color: var(--login-navy-900); }

.login-legal { margin-top: 14px; color: var(--login-muted); font-size: 0.74rem; font-weight: 400; }
.login-legal a { color: var(--login-muted); }
.login-legal a:hover { color: var(--login-navy-900); }

.mi-message {
    margin-bottom: 16px;
    border-radius: 9px;
    font-size: 0.82rem;
}

body.mi-legal-body .login-panel {
    padding: 38px 40px 32px;
}

body.mi-legal-body .login-panel__header p a {
    color: var(--login-navy-700);
    font-weight: 700;
    text-decoration: none;
}

body.mi-legal-body .login-panel__header p a:hover {
    color: var(--login-navy-900);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 24px;
}

.legal-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--login-line-strong);
    border-radius: 9px;
    background: var(--login-white);
    color: var(--login-ink-soft);
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.legal-tabs a:hover {
    border-color: var(--login-sky-400);
    background: var(--login-sky-50);
    color: var(--login-navy-900);
}

.legal-tabs a.is-active {
    border-color: var(--login-navy-900);
    background: var(--login-navy-900);
    color: var(--login-white);
}

.legal-body {
    display: grid;
    gap: 24px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    color: var(--login-ink);
    font-size: 0.94rem;
    font-weight: 400;
    line-height: 1.7;
}

.legal-body section h2 {
    margin: 0 0 8px;
    color: var(--login-navy-950);
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.35;
    text-wrap: pretty;
}

.legal-body p,
.legal-body ul {
    margin: 0;
    max-width: 72ch;
}

.legal-body ul {
    padding-left: 1.2em;
    display: grid;
    gap: 8px;
}

.legal-body a {
    color: var(--login-navy-700);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-body a:hover {
    color: var(--login-navy-900);
}

body.mi-login-body :focus-visible { outline: 3px solid var(--login-sky-400); outline-offset: 3px; }

@media (max-width: 640px) {
    body.mi-register-body .login-form {
        grid-template-columns: 1fr;
    }

    body.mi-legal-body .login-panel {
        padding: 32px 24px 28px;
    }
}

@media (max-width: 480px) {
    body.mi-login-body { padding: 18px 12px; }

    .login-panel {
        padding: 30px 20px 24px;
        border-radius: 14px;
    }

    .login-logo.login-logo--panel { max-width: 138px; max-height: 56px; margin-bottom: 16px; }
    .login-panel__header h1 { font-size: 1.48rem; }

    .legal-tabs {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 360px) {
    .login-oauth-row { grid-template-columns: 1fr !important; }
}

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