:root {
    --auth-950: #063b36;
    --auth-900: #074d47;
    --auth-800: #08675e;
    --auth-700: #087f72;
    --auth-600: #0b9585;
    --auth-100: #d9f3ee;
    --auth-50: #effaf8;
    --auth-ink: #172724;
    --auth-muted: #63736f;
    --auth-line: #dfe8e6;
    --auth-danger: #c64747;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; }
body, button, input, select, textarea { font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif; }
button, input, select, textarea { font-size: 16px; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

.auth-body {
    min-height: 100vh;
    margin: 0;
    color: var(--auth-ink);
    background: #f3f7f6;
    -webkit-font-smoothing: antialiased;
}

.auth-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(480px, 1.05fr) minmax(560px, .95fr);
}

.auth-visual {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 680px;
    overflow: hidden;
    color: #fff;
    background: var(--auth-900);
}

.auth-visual > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 47% center;
    filter: saturate(.9) contrast(1.03);
}

.auth-visual__shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(3, 43, 39, .42), rgba(3, 43, 39, .12) 36%, rgba(3, 43, 39, .8)),
        linear-gradient(90deg, rgba(4, 54, 49, .42), transparent 68%);
}

.auth-visual__brand {
    position: absolute;
    top: 34px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-visual__brand > span {
    position: relative;
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 14px;
    background: rgba(255, 255, 255, .16);
    backdrop-filter: blur(12px);
}

.auth-visual__brand > span i,
.auth-visual__brand > span b {
    position: absolute;
    border-radius: 3px;
    background: #fff;
}
.auth-visual__brand > span i { width: 9px; height: 28px; }
.auth-visual__brand > span b { width: 28px; height: 9px; }
.auth-visual__brand > span em { position: relative; z-index: 1; color: var(--auth-800); font-family: Arial, sans-serif; font-size: 17px; font-style: normal; font-weight: 700; }
.auth-visual__brand > div { display: flex; flex-direction: column; }
.auth-visual__brand strong { font-size: 19px; }
.auth-visual__brand small { color: rgba(255,255,255,.75); font: 11px/1.3 Arial, sans-serif; letter-spacing: 1px; text-transform: uppercase; }

.auth-visual__copy {
    position: absolute;
    right: 40px;
    bottom: 92px;
    left: 40px;
    max-width: 680px;
}

.auth-visual__copy > span {
    display: inline-flex;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 20px;
    background: rgba(4, 65, 58, .22);
    font: 700 11px/1 Arial, sans-serif;
    letter-spacing: 1.7px;
    backdrop-filter: blur(8px);
}

.auth-visual__copy h1 {
    max-width: 630px;
    margin: 17px 0 13px;
    font-size: clamp(36px, 4vw, 58px);
    line-height: 1.23;
    letter-spacing: -1px;
    text-shadow: 0 3px 20px rgba(0,0,0,.22);
}

.auth-visual__copy > p {
    max-width: 610px;
    margin: 0;
    color: rgba(255,255,255,.88);
    font-size: 16px;
    line-height: 1.8;
}

.auth-visual__features {
    display: flex;
    gap: 11px;
    margin-top: 23px;
}

.auth-visual__features > span {
    display: grid;
    min-width: 205px;
    grid-template-columns: 37px auto;
    align-items: center;
    gap: 0 9px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 12px;
    background: rgba(4, 54, 49, .32);
    backdrop-filter: blur(10px);
}

.auth-visual__features svg { grid-row: 1 / 3; width: 37px; height: 37px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.14); }
.auth-visual__features b { font-size: 13px; }
.auth-visual__features small { color: rgba(255,255,255,.7); font-size: 11px; }
.auth-visual > footer { position: absolute; right: 40px; bottom: 27px; left: 40px; display: flex; justify-content: space-between; color: rgba(255,255,255,.64); font-size: 11px; }

.auth-panel {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: center;
    padding: 46px clamp(32px, 5vw, 84px);
    background:
        radial-gradient(circle at 92% 2%, rgba(11,149,133,.08), transparent 25%),
        #f8fbfa;
}

.auth-panel__inner { width: min(540px, 100%); margin: auto; }
.auth-mobile-brand { display: none; }
.auth-heading { margin-bottom: 22px; }
.auth-heading[data-heading="register"] { display: none; }
.auth-heading > span { color: var(--auth-700); font-size: 13px; font-weight: 700; letter-spacing: 1px; }
.auth-heading h2 { margin: 4px 0 4px; font-size: clamp(31px, 3.5vw, 42px); line-height: 1.25; }
.auth-heading p { margin: 0; color: var(--auth-muted); font-size: 15px; }

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
    margin-bottom: 18px;
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    background: #eef4f2;
}

.auth-tabs button {
    min-height: 43px;
    border: 0;
    border-radius: 9px;
    color: var(--auth-muted);
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.auth-tabs button[aria-selected="true"] { color: var(--auth-800); background: #fff; box-shadow: 0 3px 12px rgba(26,62,55,.08); }

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 13px;
    margin-bottom: 16px;
    border: 1px solid;
    border-radius: 11px;
}

.auth-alert > span { display: grid; width: 27px; height: 27px; flex: 0 0 auto; place-items: center; border-radius: 8px; color: #fff; font-size: 14px; font-weight: 700; }
.auth-alert strong { font-size: 14px; }
.auth-alert p { margin: 1px 0 0; font-size: 12px; }
.auth-alert ul { padding: 0 0 0 17px; margin: 3px 0 0; font-size: 12px; }
.auth-alert--success { border-color: #bce2d9; color: #276a5d; background: #f0faf7; }
.auth-alert--success > span { background: var(--auth-600); }
.auth-alert--error { border-color: #efcaca; color: #973d3d; background: #fff5f5; }
.auth-alert--error > span { background: var(--auth-danger); }

.auth-form { display: grid; gap: 15px; }
.auth-form[data-auth-form="register"] { display: none; }
.auth-form > label:not(.auth-terms), .register-grid label { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.auth-form > label > span, .register-grid label > span { color: #3a4b47; font-size: 14px; font-weight: 600; }

.auth-input {
    display: grid;
    min-height: 52px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 0 13px;
    border: 1px solid #d7e3e0;
    border-radius: 11px;
    background: #fff;
    transition: border .18s, box-shadow .18s;
}

.auth-input:focus-within { border-color: var(--auth-600); box-shadow: 0 0 0 4px rgba(11,149,133,.1); }
.auth-input > svg { width: 20px; height: 20px; color: #73837f; }
.auth-input input { min-width: 0; height: 50px; border: 0; outline: 0; color: var(--auth-ink); background: transparent; }
.auth-input > button, .register-password > button { padding: 5px; border: 0; color: #7d8b88; background: transparent; cursor: pointer; }
.auth-input > button svg, .register-password > button svg { width: 20px; height: 20px; }

.auth-form__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--auth-muted); font-size: 12px; }
.auth-form__meta > label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.auth-form__meta input, .auth-terms input { width: 17px; height: 17px; accent-color: var(--auth-700); }

.auth-submit {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(135deg, var(--auth-600), var(--auth-800));
    box-shadow: 0 10px 24px rgba(8,127,114,.2);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s, box-shadow .18s;
}

.auth-submit:hover { box-shadow: 0 13px 30px rgba(8,127,114,.28); transform: translateY(-1px); }
.auth-submit svg { width: 19px; height: 19px; }
.auth-submit:disabled { cursor: wait; opacity: .65; transform: none; }
.auth-switch { margin: 1px 0 0; color: var(--auth-muted); font-size: 13px; text-align: center; }
.auth-switch button { padding: 0; border: 0; color: var(--auth-700); background: transparent; font-size: inherit; font-weight: 700; cursor: pointer; }

.auth-panel__footer { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 20px; margin-top: 22px; border-top: 1px solid var(--auth-line); color: var(--auth-muted); font-size: 11px; }
.auth-panel__footer a { display: inline-flex; align-items: center; gap: 4px; color: var(--auth-700); }
.auth-panel__footer svg { width: 14px; height: 14px; }

/* Register form */
.auth-register-form { gap: 13px; }
.register-section { padding: 15px; border: 1px solid var(--auth-line); border-radius: 13px; background: #fff; }
.register-section > header { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.register-section > header > span { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; border-radius: 8px; color: #fff; background: var(--auth-700); font-size: 12px; font-weight: 700; }
.register-section > header > div { display: flex; flex-direction: column; }
.register-section > header strong { font-size: 14px; }
.register-section > header small { color: var(--auth-muted); font-size: 10px; }
.register-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
.register-grid + .register-grid { margin-top: 11px; }
.register-grid--name { grid-template-columns: .65fr 1.2fr 1.2fr; }
.register-grid__full { grid-column: 1 / -1; }
.register-grid input, .register-grid select {
    width: 100%;
    min-height: 43px;
    padding: 8px 10px;
    border: 1px solid #d8e3e0;
    border-radius: 9px;
    outline: 0;
    color: var(--auth-ink);
    background: #fff;
    font-size: 14px;
}
.register-grid input:focus, .register-grid select:focus { border-color: var(--auth-600); box-shadow: 0 0 0 3px rgba(11,149,133,.09); }
.register-grid label > small { color: var(--auth-muted); font-size: 10px; }
.register-password { display: grid; grid-template-columns: 1fr auto; border: 1px solid #d8e3e0; border-radius: 9px; }
.register-password:focus-within { border-color: var(--auth-600); box-shadow: 0 0 0 3px rgba(11,149,133,.09); }
.register-password input { border: 0; box-shadow: none !important; }
.register-password > button { padding-inline: 9px; }

.system-choice { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin-bottom: 12px; }
.system-choice input { position: absolute; opacity: 0; pointer-events: none; }
.system-choice label > span { position: relative; display: grid; min-height: 84px; grid-template-columns: 38px 1fr; align-items: center; gap: 0 9px; padding: 11px; border: 1px solid #d8e3e0; border-radius: 10px; cursor: pointer; }
.system-choice svg { grid-row: 1/3; width: 38px; height: 38px; padding: 9px; border-radius: 10px; color: var(--auth-700); background: var(--auth-50); }
.system-choice b { font-size: 13px; }
.system-choice small { color: var(--auth-muted); font-size: 10px; }
.system-choice i { position: absolute; top: 8px; right: 8px; display: none; width: 18px; height: 18px; place-items: center; border-radius: 50%; color: #fff; background: var(--auth-700); font-size: 10px; font-style: normal; }
.system-choice input:checked + span { border-color: var(--auth-600); background: var(--auth-50); box-shadow: 0 0 0 2px rgba(11,149,133,.08); }
.system-choice input:checked + span i { display: grid; }
.auth-terms { display: flex; align-items: flex-start; gap: 8px; color: var(--auth-muted); font-size: 11px; line-height: 1.55; cursor: pointer; }
.auth-terms input { flex: 0 0 auto; margin-top: 1px; }

body[data-auth-mode="register"] .auth-heading[data-heading="login"],
body[data-auth-mode="register"] .auth-form[data-auth-form="login"] { display: none; }
body[data-auth-mode="register"] .auth-heading[data-heading="register"] { display: block; }
body[data-auth-mode="register"] .auth-form[data-auth-form="register"] { display: grid; }

/* Change password and access denied */
.access-body {
    display: grid;
    min-height: 100vh;
    padding: 22px;
    margin: 0;
    place-items: center;
    color: var(--auth-ink);
    background: radial-gradient(circle at 20% 10%, rgba(11,149,133,.12), transparent 30%), #f4f8f7;
}

.access-card {
    width: min(520px, 100%);
    padding: 42px;
    border: 1px solid var(--auth-line);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(20,55,49,.12);
    text-align: center;
}

.access-card__icon { display: grid; width: 60px; height: 60px; margin: 0 auto 16px; place-items: center; border-radius: 17px; color: #fff; background: linear-gradient(145deg, #d16161, #a83f3f); font-size: 25px; font-weight: 700; }
.access-card > small { color: var(--auth-700); font: 700 11px Arial, sans-serif; letter-spacing: 1.4px; }
.access-card h1 { margin: 7px 0 9px; font-size: 30px; }
.access-card p { margin: 0; color: var(--auth-muted); font-size: 15px; line-height: 1.8; }
.access-card > div { display: flex; justify-content: center; gap: 9px; margin-top: 22px; }
.access-card > div form { margin: 0; }
.access-card > div a, .access-card > div button { padding: 11px 16px; border: 0; border-radius: 9px; color: #fff; background: var(--auth-700); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.access-card > div .access-card__logout { color: var(--auth-muted); background: #edf3f2; }

.password-page { display: grid; min-height: 100vh; grid-template-columns: minmax(350px,.8fr) minmax(500px,1.2fr); background: #f6f9f8; }
.password-page__aside { position: relative; min-height: 100vh; overflow: hidden; color: #fff; background: var(--auth-900); }
.password-page__aside img { width: 100%; height: 100%; object-fit: cover; }
.password-page__aside::after { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3,52,47,.35), rgba(3,52,47,.82)); content: ""; }
.password-page__aside > div { position: absolute; right: 35px; bottom: 42px; left: 35px; z-index: 1; }
.password-page__aside h1 { margin: 0 0 8px; font-size: 34px; }
.password-page__aside p { margin: 0; color: rgba(255,255,255,.8); font-size: 15px; line-height: 1.7; }
.password-page__main { display: grid; padding: 30px; place-items: center; }
.password-card { width: min(520px, 100%); padding: 32px; border: 1px solid var(--auth-line); border-radius: 20px; background: #fff; box-shadow: 0 18px 55px rgba(18,54,48,.08); }
.password-card__badge { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 14px; color: var(--auth-700); background: var(--auth-50); }
.password-card__badge svg { width: 25px; height: 25px; }
.password-card h2 { margin: 15px 0 4px; font-size: 27px; }
.password-card > p { margin: 0 0 20px; color: var(--auth-muted); font-size: 14px; line-height: 1.65; }
.password-card form { display: grid; gap: 13px; }
.password-card form > label { display: flex; flex-direction: column; gap: 5px; }
.password-card form > label > span { font-size: 13px; font-weight: 600; }
.password-card input { min-height: 47px; padding: 9px 11px; border: 1px solid #d8e3e0; border-radius: 9px; outline: 0; }
.password-card input:focus { border-color: var(--auth-600); box-shadow: 0 0 0 3px rgba(11,149,133,.09); }
.password-card__note { padding: 10px 12px; border-radius: 9px; color: var(--auth-muted); background: #f3f7f6; font-size: 11px; }

*:focus-visible { outline: 3px solid rgba(8,127,114,.22); outline-offset: 2px; }

@media (max-width: 1100px) {
    .auth-layout { grid-template-columns: minmax(390px,.8fr) minmax(520px,1.2fr); }
    .auth-visual__features { flex-direction: column; }
    .auth-visual__features > span { width: 235px; }
}

@media (max-width: 860px) {
    .auth-layout { display: block; }
    .auth-visual { display: none; }
    .auth-panel { width: 100%; max-width: 100vw; min-height: 100vh; padding: 30px 20px; overflow-x: hidden; }
    .auth-panel__inner { width: calc(100vw - 40px); max-width: 540px; min-width: 0; }
    .auth-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
    .auth-mobile-brand > span { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 12px; color: #fff; background: var(--auth-700); font: 300 28px Arial, sans-serif; }
    .auth-mobile-brand > div { display: flex; flex-direction: column; }
    .auth-mobile-brand strong { font-size: 16px; }
    .auth-mobile-brand small { color: var(--auth-muted); font-size: 11px; }
    .password-page { grid-template-columns: 1fr; }
    .password-page__aside { display: none; }
}

@media (max-width: 560px) {
    .auth-panel { padding: 22px 15px; }
    .auth-panel__inner { width: calc(100vw - 30px); }
    .auth-heading h2 { font-size: 32px; }
    .auth-form__meta { align-items: flex-start; flex-direction: column; }
    .auth-panel__footer { align-items: flex-start; flex-direction: column; }
    .register-grid, .register-grid--name { grid-template-columns: 1fr; }
    .register-grid__full { grid-column: auto; }
    .system-choice { grid-template-columns: 1fr; }
    .access-card { padding: 30px 20px; }
    .access-card > div { flex-direction: column; }
    .password-page__main { padding: 15px; }
    .password-card { padding: 24px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
