:root {
    --navy: #1e40af;
    --navy-ink: #16348f;
    --teal: #14b8a6;
    --paper: #eef2f7;
    --text: #152033;
    --muted: #5b6a7c;
    --line: #cfd8e3;
    --danger: #b42318;
    --white: #ffffff;
}

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

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

body.apm-login {
    color: var(--text);
    background: var(--paper);
    font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

.apm-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.apm-plaque {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 48px 36px 40px;
    background: var(--navy);
    color: var(--white);
    overflow: hidden;
}

.apm-mark {
    width: 48px;
    height: 48px;
    display: block;
    flex: 0 0 auto;
}

.apm-name {
    margin: 28px 0 0;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.03em;
    white-space: nowrap;
    word-break: keep-all;
}

.apm-plaque-sub {
    margin: 8px 0 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .28em;
    color: var(--teal);
}

.apm-spine {
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 0;
    background: var(--teal);
    animation: apm-spine 0.9s ease-out forwards;
}

.apm-gate {
    display: flex;
    align-items: center;
    padding: 48px 8vw;
}

.apm-gate-inner {
    width: 100%;
    max-width: 400px;
}

.apm-tenant {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--navy);
}

.apm-gate h1 {
    margin: 0;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1.15;
}

.apm-lead {
    margin: 10px 0 32px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.5;
}

.apm-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.apm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.apm-field span {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.apm-field input {
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--white);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    outline: none;
}

.apm-field input:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, .15);
}

.apm-keep {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    user-select: none;
}

.apm-keep input {
    width: 16px;
    height: 16px;
    accent-color: var(--navy);
}

.apm-submit {
    margin-top: 8px;
    height: 48px;
    border: 0;
    border-radius: 2px;
    background: var(--navy);
    color: var(--white);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.apm-submit:hover,
.apm-submit:focus-visible {
    background: var(--navy-ink);
}

.apm-submit:focus-visible,
.apm-btn-ghost:focus-visible,
.apm-field input:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.apm-submit:disabled {
    opacity: .6;
    cursor: wait;
}

.apm-error,
.apm-client-error {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: 2px;
    background: #fef3f2;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.45;
}

.apm-client-error[hidden] {
    display: none;
}

.apm-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(21, 32, 51, .4);
}

.apm-modal[hidden] {
    display: none;
}

.apm-modal-card {
    width: min(420px, calc(100vw - 32px));
    padding: 24px;
    border-radius: 4px;
    background: var(--white);
}

.apm-modal-card h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.apm-modal-card p {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.apm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.apm-btn-ghost {
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--white);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

@keyframes apm-spine {
    to {
        height: 100%;
    }
}

@media (max-width: 860px) {
    .apm-shell {
        grid-template-columns: 1fr;
    }

    .apm-plaque {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px 14px;
        padding: 16px 20px;
    }

    .apm-mark {
        width: 36px;
        height: 36px;
    }

    .apm-name {
        margin: 0;
        font-size: 20px;
    }

    .apm-plaque-sub {
        margin: 0 0 0 auto;
        letter-spacing: .18em;
    }

    .apm-spine {
        top: auto;
        right: auto;
        left: 0;
        bottom: 0;
        width: 0;
        height: 4px;
        animation-name: apm-spine-h;
    }

    .apm-gate {
        align-items: flex-start;
        padding: 32px 24px 48px;
    }
}

@keyframes apm-spine-h {
    to {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .apm-spine {
        animation: none;
        height: 100%;
    }

    @media (max-width: 860px) {
        .apm-spine {
            width: 100%;
            height: 4px;
        }
    }
}
