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

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    overflow-x: hidden;
    color: #111827;
    background: #dce7f1;
    font-family: "Sarabun", Arial, sans-serif;
}

.legacy-home {
    min-height: 100vh;
    display: grid;
    grid-template-rows: 94px minmax(0, 1fr);
    border: 4px solid #161616;
    background: #e7ebf1;
}

.legacy-header {
    position: relative;
    z-index: 2;
    border-bottom: 2px solid rgba(20, 75, 121, .72);
    background: rgba(246, 247, 250, .92);
}

.legacy-header__inner {
    width: min(1230px, calc(100% - 40px));
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.legacy-header__title {
    font-size: clamp(1.08rem, 1.45vw, 1.38rem);
    font-weight: 800;
    line-height: 1.25;
}

.legacy-header__subtitle {
    margin-top: .45rem;
    font-size: 1rem;
    font-weight: 700;
}

.legacy-stage {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(28px, 5vh, 50px) 20px;
    background-image: url('/img/bchindex-bg.jpg');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.legacy-login-card {
    width: min(845px, 74vw);
    min-height: min(565px, calc(100vh - 150px));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 46px 52px;
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: 24px;
    background: rgba(255, 255, 255, .84);
    box-shadow: 0 16px 46px rgba(0, 45, 84, .16);
    text-align: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.legacy-hospital-logo {
    width: 134px;
    height: 134px;
    padding: 10px;
    object-fit: contain;
    background: #fff;
}

.legacy-system-code {
    margin-top: 38px;
    color: #075c9d;
    font-size: 2.45rem;
    font-weight: 800;
    letter-spacing: .08em;
    line-height: 1;
}

.legacy-system-name {
    margin-top: 12px;
    color: #52606d;
    font-size: 1rem;
    letter-spacing: .13em;
}

.legacy-hospital-name {
    margin-top: 34px;
    color: #15191d;
    font-size: clamp(1.3rem, 2vw, 1.85rem);
    line-height: 1.2;
}

.legacy-login-row {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.legacy-version {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 7px 20px;
    border: 1px solid rgba(17, 90, 146, .38);
    border-radius: 5px;
    color: #215a83;
    background: rgba(231, 240, 248, .68);
    font-size: .82rem;
    letter-spacing: .1em;
    white-space: nowrap;
}

.legacy-login-button {
    min-height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 48px;
    border-radius: 32px;
    color: #fff;
    background: linear-gradient(135deg, #138bd7, #159be9);
    box-shadow: 0 10px 24px rgba(8, 119, 190, .22);
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease;
}

.legacy-login-button:hover,
.legacy-login-button:focus-visible {
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(8, 119, 190, .3);
}

@media (max-width: 767.98px) {
    .legacy-home {
        grid-template-rows: 86px minmax(0, 1fr);
        border-width: 2px;
    }

    .legacy-header__inner {
        width: calc(100% - 28px);
    }

    .legacy-login-card {
        width: min(94vw, 620px);
        min-height: 0;
        padding: 34px 22px;
    }

    .legacy-hospital-logo {
        width: 104px;
        height: 104px;
    }

    .legacy-system-code {
        margin-top: 26px;
        font-size: 2rem;
    }

    .legacy-hospital-name {
        margin-top: 26px;
    }

    .legacy-login-row {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .legacy-version,
    .legacy-login-button {
        width: 100%;
    }
}
