:root {
    --login-komori-ink: #0f2138;
    --login-komori-ink-soft: #44556d;
    --login-komori-blue: #0b5fff;
    --login-komori-blue-deep: #093a9f;
    --login-komori-cyan: #0ea5e9;
    --login-komori-steel: #d7e1ee;
    --login-komori-surface: rgba(255, 255, 255, 0.96);
    --login-komori-surface-strong: #ffffff;
    --login-komori-line: rgba(15, 33, 56, 0.12);
    --login-komori-shadow: 0 30px 60px rgba(15, 23, 42, 0.16);
    --login-komori-shadow-soft: 0 16px 36px rgba(15, 23, 42, 0.10);
    --login-komori-radius: 28px;
    --login-bg-shift-x: 0px;
    --login-bg-shift-y: 0px;
}

@keyframes login-tech-grid-shift {
    0% {
        transform: translate3d(calc(var(--login-bg-shift-x) * 0.28), calc(var(--login-bg-shift-y) * 0.28), 0) scale(1);
    }
    50% {
        transform: translate3d(calc((var(--login-bg-shift-x) * 0.28) - 12px), calc((var(--login-bg-shift-y) * 0.28) + 10px), 0) scale(1.02);
    }
    100% {
        transform: translate3d(calc(var(--login-bg-shift-x) * 0.28), calc(var(--login-bg-shift-y) * 0.28), 0) scale(1);
    }
}

@keyframes login-tech-glow-drift {
    0% {
        transform: translate3d(calc(var(--login-bg-shift-x) * 0.56), calc(var(--login-bg-shift-y) * 0.56), 0);
        opacity: 0.9;
    }
    50% {
        transform: translate3d(calc((var(--login-bg-shift-x) * 0.56) + 16px), calc((var(--login-bg-shift-y) * 0.56) - 12px), 0);
        opacity: 1;
    }
    100% {
        transform: translate3d(calc(var(--login-bg-shift-x) * 0.56), calc(var(--login-bg-shift-y) * 0.56), 0);
        opacity: 0.9;
    }
}

body.login-page {
    font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 14% 18%, rgba(11, 95, 255, 0.12), transparent 28%),
        radial-gradient(circle at 88% 12%, rgba(14, 165, 233, 0.10), transparent 24%),
        radial-gradient(circle at 84% 82%, rgba(15, 118, 110, 0.07), transparent 22%),
        linear-gradient(160deg, #f4f8fc 0%, #edf4fb 42%, #f7fafc 100%);
    color: var(--login-komori-ink);
    padding: clamp(8px, 2.2svh, 18px);
    overflow-x: hidden;
}

body.login-page::before,
body.login-page::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body.login-page::before {
    z-index: 0;
    background:
        linear-gradient(115deg, transparent 0 59%, rgba(11, 95, 255, 0.035) 59%, rgba(11, 95, 255, 0.035) 60%, transparent 60%),
        linear-gradient(90deg, rgba(11, 95, 255, 0.028) 1px, transparent 1px),
        linear-gradient(rgba(14, 165, 233, 0.022) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    background-position: center center, center center, center center;
    opacity: 0.9;
    animation: login-tech-grid-shift 18s ease-in-out infinite;
    will-change: transform;
}

body.login-page::after {
    z-index: 0;
    background:
        radial-gradient(circle at 28% 54%, rgba(11, 95, 255, 0.08), transparent 18%),
        radial-gradient(circle at 70% 30%, rgba(14, 165, 233, 0.06), transparent 14%),
        radial-gradient(circle at 78% 76%, rgba(15, 118, 110, 0.05), transparent 16%);
    animation: login-tech-glow-drift 14s ease-in-out infinite;
    will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --login-bg-shift-x: 0px;
        --login-bg-shift-y: 0px;
    }

    body.login-page::before,
    body.login-page::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
    }
}

.login-shell {
    width: min(100%, 1080px);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    position: relative;
    z-index: 1;
    margin: auto;
}

.login-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    align-items: flex-start;
    padding: 22px 22px 4px;
    margin-bottom: 0;
}

.login-brand::before {
    content: "KOMORI ACCESS";
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(11, 95, 255, 0.08);
    border: 1px solid rgba(11, 95, 255, 0.14);
    color: var(--login-komori-blue-deep);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.login-brand-logo-wrap {
    width: min(420px, 100%);
    max-width: 100%;
    justify-content: flex-start;
}

.login-brand-logo,
.login-brand-name {
    filter: saturate(1.02);
}

.login-brand-logo {
    width: 100%;
    max-width: 420px;
}

.login-brand-copy {
    max-width: 30ch;
    margin: 0;
    color: var(--login-komori-ink-soft);
    font-size: 1.02rem;
    line-height: 1.7;
}

.login-brand-name {
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    font-weight: 800;
    color: var(--login-komori-blue-deep);
    letter-spacing: 0.02em;
}

.login-panel {
    padding: 0;
}

.login-box-modern {
    width: 100%;
    max-width: 100%;
    padding: 18px;
    border-radius: var(--login-komori-radius);
    border: 1px solid rgba(255, 255, 255, 0.78);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(247, 250, 253, 0.98) 100%);
    box-shadow: var(--login-komori-shadow);
    backdrop-filter: blur(12px);
}

.login-panel {
    justify-content: flex-end;
}

#login-form-section,
#qr-login-panel,
#face-login-panel {
    background: transparent;
}

.login-lang-pill {
    float: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: nowrap;
    width: fit-content;
    max-width: 100%;
    padding: 3px 4px;
    margin: 0 auto 18px;
    border-radius: 999px;
    background: rgba(238, 244, 251, 0.9);
    border: 1px solid var(--login-komori-line);
}

.login-lang-pill a {
    width: 32px;
    min-width: 32px;
    min-height: 24px;
    padding: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: #546781;
    text-align: center;
    transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.login-lang-pill a:hover,
.login-lang-pill a:focus {
    background: var(--login-komori-surface-strong);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.login-lang-pill a.is-active {
    background: linear-gradient(180deg, #ffffff 0%, #f2f7ff 100%);
    color: var(--login-komori-blue-deep);
    box-shadow: 0 4px 12px rgba(11, 95, 255, 0.10);
    border: 1px solid rgba(11, 95, 255, 0.12);
}

.login-lang-flag {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 11px;
    border-radius: 2px;
    border: 1px solid rgba(15, 33, 56, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    overflow: hidden;
}

.login-lang-flag-pt {
    background: #1c8c49;
}

.login-lang-flag-pt::before {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 8px;
    height: 8px;
    background: #f1c63a;
    transform: translate(-50%, -50%) rotate(45deg);
}

.login-lang-flag-pt::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #1f4ea3;
    transform: translate(-50%, -50%);
}

.login-lang-flag-jp {
    background: #ffffff;
}

.login-lang-flag-jp::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #d43939;
    transform: translate(-50%, -50%);
}

.login-lang-flag-en {
    background:
        linear-gradient(180deg,
            #b22234 0%, #b22234 14.28%,
            #ffffff 14.28%, #ffffff 28.56%,
            #b22234 28.56%, #b22234 42.84%,
            #ffffff 42.84%, #ffffff 57.12%,
            #b22234 57.12%, #b22234 71.4%,
            #ffffff 71.4%, #ffffff 85.68%,
            #b22234 85.68%, #b22234 100%);
}

.login-lang-flag-en::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 7px;
    height: 6px;
    background: #3c3b6e;
}

.login-header.login-header-left {
    margin-bottom: 22px;
}

.login-header h2 {
    margin: 0 0 8px;
    font-size: clamp(1.6rem, 4vw, 2.15rem);
    font-weight: 800;
    line-height: 1.05;
    color: var(--login-komori-ink);
}

.login-header p {
    max-width: 42ch;
    color: var(--login-komori-ink-soft);
    font-size: 0.95rem;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label,
.login-label-row label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #51627b;
}

.login-forgot-link {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--login-komori-blue-deep);
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap i {
    left: 16px;
    color: #7290b1;
}

.login-input-wrap .form-control {
    min-height: 54px;
    padding-left: 46px;
}

.form-control {
    border-radius: 18px;
    border: 1px solid rgba(15, 33, 56, 0.12);
    background: rgba(247, 250, 253, 0.95);
    color: var(--login-komori-ink);
    font-size: 1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.form-control::placeholder {
    color: #86a0bc;
}

.form-control:focus {
    border-color: rgba(11, 95, 255, 0.34);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(11, 95, 255, 0.10);
}

.btn {
    min-height: 52px;
    border-radius: 18px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.btn-login-submit,
.qr-login-scan-btn,
.face-login-scan-btn {
    position: relative;
    overflow: hidden;
    justify-content: center;
    gap: 10px;
    border: 0;
    color: #ffffff !important;
}

.btn-login-submit {
    background: linear-gradient(135deg, #0b63ff 0%, #1657dc 54%, #113f9f 100%);
    box-shadow: 0 14px 32px rgba(11, 95, 255, 0.26);
}

.btn-login-submit:hover,
.btn-login-submit:focus {
    transform: translateY(-1px);
    box-shadow: 0 18px 38px rgba(11, 95, 255, 0.28);
}

.btn-login-submit::after,
.qr-login-scan-btn::after,
.face-login-scan-btn::after {
    content: "";
    position: absolute;
    inset: auto -12px -18px auto;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.login-qr-divider {
    margin: 18px 0 12px;
    color: #6b7f99;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.qr-login-scan-btn {
    background: linear-gradient(135deg, #0d8b80 0%, #11786f 55%, #0e5f64 100%) !important;
    box-shadow: 0 14px 30px rgba(13, 139, 128, 0.24) !important;
    margin-bottom: 12px;
}

.qr-login-scan-btn:hover,
.qr-login-scan-btn:focus {
    transform: translateY(-1px);
    box-shadow: 0 18px 38px rgba(13, 139, 128, 0.28) !important;
}

.face-login-scan-btn {
    margin-top: 0;
    background: linear-gradient(135deg, #243247 0%, #1f4d75 52%, #1d7b86 100%) !important;
    box-shadow: 0 14px 30px rgba(31, 77, 117, 0.22) !important;
}

.face-login-scan-btn:hover,
.face-login-scan-btn:focus {
    transform: translateY(-1px);
    box-shadow: 0 18px 38px rgba(31, 77, 117, 0.26) !important;
}

.face-login-note {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(14, 165, 233, 0.08);
    color: #51627b;
    font-size: 0.8rem;
    line-height: 1.45;
}

.qr-login-panel-header {
    margin-bottom: 16px;
}

.qr-login-panel-header h3 {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--login-komori-ink);
}

.qr-login-panel-header p {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--login-komori-ink-soft);
}

.qr-video-wrap {
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: var(--login-komori-shadow-soft);
    max-height: 320px;
}

.qr-scan-area {
    border: 2px solid rgba(255, 255, 255, 0.92);
    border-radius: 24px;
}

.qr-login-status {
    margin-top: 12px;
    font-size: 0.84rem;
    color: #556b87;
}

.qr-login-back-btn {
    margin-top: 14px;
    background: #eef4fb;
    color: #2b4566;
    border: 1px solid rgba(15, 33, 56, 0.10);
}

.qr-login-back-btn:hover,
.qr-login-back-btn:focus {
    background: #e5eef8;
    box-shadow: none;
    transform: none;
}

.qr-switch-cam-btn {
    bottom: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.64);
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.qr-result-modal {
    padding: 12px 0 4px;
}

.qr-result-photo-wrap {
    width: 96px;
    height: 96px;
}

.qr-result-name {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--login-komori-ink);
}

.qr-result-msg {
    font-size: 0.9rem;
    line-height: 1.45;
}

.alert.alert-danger {
    border-radius: 18px;
    border: 1px solid rgba(185, 28, 28, 0.12);
    background: linear-gradient(180deg, #fff5f5 0%, #fef2f2 100%);
    color: #b91c1c;
}

@media (min-width: 920px) {
    .login-shell {
        grid-template-columns: minmax(320px, 1.08fr) minmax(420px, 0.92fr);
        align-items: center;
        gap: 22px;
    }

    .login-brand {
        width: min(100%, 480px);
        min-height: 100%;
        align-self: center;
        justify-self: start;
        padding: 8px 0 8px 6px;
        gap: 18px;
    }

    .login-box-modern {
        padding: 28px;
        max-width: 430px;
        margin-left: auto;
    }
}

@media (max-width: 919.98px) {
    .login-brand {
        align-items: center;
        padding: 10px 0 2px;
        text-align: center;
    }

    .login-brand::before {
        align-self: center;
    }
}

@media (max-width: 640px) {
    body.login-page {
        align-items: flex-start;
        padding: 8px;
    }

    .login-shell {
        gap: 10px;
    }

    .login-box-modern {
        padding: 12px;
        border-radius: 20px;
    }

    .login-header h2 {
        font-size: 1.34rem;
    }

    .login-header p {
        font-size: 0.84rem;
        line-height: 1.42;
    }

    .login-brand-logo-wrap {
        width: min(148px, 44vw);
    }

    .login-lang-pill {
        width: fit-content;
        max-width: 100%;
        margin-bottom: 14px;
    }

    .login-lang-pill a {
        width: 30px;
        min-width: 30px;
        min-height: 22px;
    }

    .login-brand {
        gap: 8px;
        padding: 4px 0 0;
    }

    .login-brand::before {
        min-height: 24px;
        padding: 0 10px;
        font-size: 0.64rem;
    }

    .login-brand-copy {
        max-width: 24ch;
        font-size: 0.86rem;
        line-height: 1.45;
    }

    .login-header.login-header-left {
        margin-bottom: 16px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .login-input-wrap i {
        left: 14px;
    }

    .login-input-wrap .form-control {
        min-height: 48px;
        padding-left: 42px;
    }

    .btn {
        min-height: 46px;
        border-radius: 16px;
        font-size: 0.94rem;
    }

    .login-qr-divider {
        margin: 14px 0 10px;
    }

    .face-login-note {
        margin-top: 8px;
        padding: 8px 10px;
        font-size: 0.76rem;
        line-height: 1.38;
    }

    .login-label-row {
        gap: 8px;
        flex-wrap: wrap;
    }

    .qr-video-wrap {
        max-height: 280px;
    }
}

@media (max-height: 760px) {
    body.login-page {
        align-items: flex-start;
        padding: 8px;
    }

    .login-shell {
        gap: 8px;
    }

    .login-brand {
        gap: 6px;
        padding: 2px 0 0;
    }

    .login-brand::before {
        min-height: 22px;
        padding: 0 10px;
        font-size: 0.62rem;
    }

    .login-brand-copy {
        display: none;
    }

    .login-box-modern {
        padding: 12px;
    }

    .login-header.login-header-left {
        margin-bottom: 14px;
    }

    .login-header h2 {
        font-size: clamp(1.28rem, 3.8vw, 1.6rem);
    }

    .login-header p {
        font-size: 0.82rem;
        line-height: 1.38;
    }

    .form-group {
        margin-bottom: 11px;
    }

    .login-input-wrap .form-control {
        min-height: 46px;
    }

    .btn {
        min-height: 44px;
        font-size: 0.92rem;
    }

    .login-qr-divider {
        margin: 12px 0 8px;
    }

    .face-login-note {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
}

@media (max-width: 919.98px) and (orientation: landscape) and (max-height: 540px) {
    body.login-page {
        padding: 6px;
    }

    .login-brand {
        display: none;
    }

    .login-shell {
        gap: 0;
    }

    .login-box-modern {
        padding: 10px 12px;
        border-radius: 18px;
    }

    .login-lang-pill {
        margin-bottom: 10px;
    }

    .login-header.login-header-left {
        margin-bottom: 12px;
    }

    .login-header h2 {
        font-size: 1.2rem;
    }

    .login-header p {
        font-size: 0.78rem;
        line-height: 1.32;
    }

    .form-group {
        margin-bottom: 10px;
    }

    .login-input-wrap .form-control {
        min-height: 42px;
        padding-left: 40px;
    }

    .btn {
        min-height: 40px;
        font-size: 0.9rem;
    }

    .face-login-note {
        margin-top: 6px;
        padding: 6px 9px;
        font-size: 0.72rem;
    }
    }
}