* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f6f8fc;
    color: #111827;
    /* Full-viewport column (Realm, 25 Nov 2026): header at the
       top, footer locked to the bottom of the screen, and the
       card area between them grows to whatever height the
       device gives it. dvh tracks the mobile URL bar; the vh
       line stays as the fallback. */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.login-header {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 48px;
    background: #ffffff;
    border-bottom: 1px solid #dbe3ef;
}

.logo {
    font-size: 24px;
    font-weight: 700;
}

.login-page {
    flex: 1 0 auto;
    display: grid;
    grid-template-columns: 560px 1fr;
    align-items: center;
    align-content: center;
    gap: 80px;
    padding: 48px 56px;
}

.login-card {
    width: 520px;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    padding: 48px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.08);
}

.login-card h1 {
    font-size: 34px;
    text-align: center;
    margin-bottom: 12px;
}

.subtitle {
    text-align: center;
    color: #52657d;
    margin-bottom: 32px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--pap-blue);
    margin-bottom: 32px;
}

.divider::before,
.divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: #dbe3ef;
}

.divider span {
    width: 40px;
    height: 40px;
    border: 1px solid #dbe3ef;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #f8fafc;
}

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

.otp-group {
    margin-top: 22px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

input.full {
    width: 100%;
    height: 62px;
    padding: 0 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    background: #ffffff;
}

input.full:disabled {
    background: #eef4ff;
    color: #64748b;
}

button {
    width: 100%;
    height: 62px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
}

button.outline {
    border: 2px solid #2563eb;
    background: #ffffff;
    color: #2563eb;
}

button.primary {
    border: 0;
    background: #2563eb;
    color: #ffffff;
    margin-top: 16px;
    box-shadow: none;
}

button.primary:disabled {
    background: #b7d1f5;
    color: #ffffff;
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.remember {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #52657d;
    font-size: 14px;
    margin: 8px 0 18px;
}

.remember input {
    width: 16px;
    height: 16px;
}

.message {
    min-height: 24px;
    text-align: center;
    color: #52657d;
    margin-top: 16px;
    font-size: 14px;
}

.message.success {
    color: #15803d;
}

.message.error {
    color: #b91c1c;
}

.help {
    margin-top: 28px;
    text-align: center;
    color: #52657d;
    font-size: 14px;
}

.hero {
    text-align: center;
    font-size: 180px;
    opacity: 0.55;
}

html[data-theme="dark"] .hero {
    opacity: 0.92;
}

.footer {
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #64748b;
    border-top: 1px solid #dbe3ef;
    font-size: 14px;
}

.footer-sep {
    margin: 0 8px;
    color: #b6c2d2;
}

@media (max-width: 900px) {
    .login-page {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 32px 20px;
    }

    .login-card {
        width: 100%;
        padding: 36px 28px;
    }

    .hero {
        font-size: 120px;
    }

    .login-header {
        padding: 0 24px;
    }
}

/* Hide login hero icon on mobile only */
@media (max-width: 768px) {
    .hero {
        display: none !important;
    }
}

/* Compact mobile login layout. The page area keeps the body's
   flex growth (no min-height override) so the footer stays
   locked to the bottom of the screen on phones too. */
@media (max-width: 768px) {
    .login-page {
        padding: 28px 20px 32px;
    }

    .login-card {
        padding: 34px 28px 32px;
        border-radius: 14px;
    }

    .login-card h1 {
        font-size: 34px;
        margin-bottom: 12px;
    }

    .subtitle {
        margin-bottom: 18px;
    }

    .divider {
        margin-bottom: 24px;
    }

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

    .otp-group {
        margin-top: 20px;
    }

    button {
        height: 50px;
        margin-top: 8px;
    }

    button.primary {
        margin-top: 14px;
    }

    .remember {
        margin: 6px 0 14px;
    }

    .message:empty {
        min-height: 0;
        margin-top: 0;
    }

    .message {
        margin-top: 12px;
    }

    .help {
        margin-top: 22px;
    }

    .hero {
        display: none !important;
    }

    .footer {
        height: 44px;
    }
}

.hidden {
    display: none !important;
}
\n

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.hero img {
    width: 170px;
    height: 170px;
    object-fit: contain;
}

/* Desktop SocioEngage hero image */
@media (min-width: 901px) {
    .hero {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .hero img {
        width: 360px;
        height: auto;
        object-fit: contain;
    }

    .login-page {
        grid-template-columns: 560px 1fr;
        justify-content: initial;
    }
}


.logo img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Login header brand alignment */
.login-header .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

.login-header .logo img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
    transform: translateY(1px);
}

.login-header .logo {
    font-size: 24px;
    font-weight: 800;
}


.resend-otp {
    width: 100%;
    height: auto;
    min-height: 34px;
    border: 0;
    background: transparent;
    color: #2563eb;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
}

.resend-otp:disabled {
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 1;
}

.hidden {
    display: none !important;
}

.otp-box-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.otp-digit {
    width: 100%;
    height: 58px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    color: #111827;
}

.otp-digit:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.otp-digit:disabled {
    background: #eef4ff;
    color: #64748b;
}

.paste-otp {
    height: 38px;
    border: 0;
    background: transparent;
    color: #2563eb;
    font-size: 14px;
    font-weight: 700;
    margin-top: 8px;
}

.paste-otp:disabled {
    color: #94a3b8;
    opacity: 1;
}

@media (max-width: 420px) {
    /* The three-segment footer needs a little air on narrow phones. */
    .footer {
        font-size: 12.5px;
    }

    .footer-sep {
        margin: 0 6px;
    }

    .otp-box-row {
        gap: 7px;
    }

    .otp-digit {
        height: 50px;
        font-size: 20px;
    }
}

/* ===== Basic makeover (24 Nov 2026): dark theme follows the app preference. CSS only — no functional change. ===== */
html[data-theme="dark"] body { background: #0f172a; }
html[data-theme="dark"] .login-card { background: #1e293b; border-color: #334155; color: #e2e8f0; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); }
html[data-theme="dark"] .login-header h1, html[data-theme="dark"] .login-card h1, html[data-theme="dark"] .login-card h2 { color: #f1f5f9; }
html[data-theme="dark"] .login-card p, html[data-theme="dark"] .help, html[data-theme="dark"] .footer { color: #94a3b8; }
html[data-theme="dark"] .form-group input { background: #0f172a; border-color: #334155; color: #f1f5f9; color-scheme: dark; }
html[data-theme="dark"] .divider { border-color: #334155; color: #94a3b8; }
html[data-theme="dark"] .login-header { background: #1e293b; border-color: #334155; color: #f1f5f9; }

/* ===== Theme toggle (24 Nov 2026): mirrors css/layout.css .theme-toggle so
   the login page matches the signed-in shell. Text colour is set in the same
   rule as the background in both themes (button-contrast rule). ===== */
.login-header .theme-toggle {
    margin-left: auto;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #ffffff;
    color: #53657d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
}

.theme-toggle:hover {
    color: #005bac;
    border-color: #bfdbfe;
}

html[data-theme="dark"] .theme-toggle {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

html[data-theme="dark"] .theme-toggle:hover {
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.45);
}

/* ===== Install toast (25 Nov 2026): the PWA install offer on
   the login page — a floating card pinned to the bottom of the
   screen, shown only when the app is not installed. Button
   colours are set in the same rule as their backgrounds
   (button-contrast rule). ===== */
.install-toast {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 430px;
    margin: 0 auto;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
    animation: install-toast-in 0.25s ease-out;
}

@keyframes install-toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.install-toast-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: #52657d;
    line-height: 1.35;
}

.install-toast-text strong {
    font-size: 14px;
    color: #111827;
}

.install-toast-install {
    width: auto;
    height: 40px;
    margin-top: 0;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    background: #2563eb;
    color: #ffffff;
    font-size: 14px;
    flex: 0 0 auto;
}

.install-toast-close {
    width: auto;
    height: 40px;
    margin-top: 0;
    padding: 0 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #52657d;
    font-size: 14px;
    flex: 0 0 auto;
}

html[data-theme="dark"] .install-toast {
    background: #1e293b;
    border-color: #334155;
}

html[data-theme="dark"] .install-toast-text {
    color: #94a3b8;
}

html[data-theme="dark"] .install-toast-text strong {
    color: #f1f5f9;
}

html[data-theme="dark"] .install-toast-close {
    color: #cbd5e1;
}

/* One-screen login fit (Realm, 25 Nov 2026): on portrait
   phones the login sits on a single screen — footer always
   visible, no page scroll — in the browser and in the
   installed app alike. The body locks to the viewport
   height, the card compacts its spacing (the OTP step is
   the tall one: 949px before this block, ~720px after),
   and only the card area itself may scroll internally on
   very short screens. Landscape and desktop keep the
   normal flow. */
@media (max-width: 900px) and (orientation: portrait) {
    body {
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .login-header {
        height: 56px;
    }

    .login-page {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        align-content: safe center;
        padding: 16px 20px;
    }

    .login-card {
        padding: 22px 22px 20px;
    }

    .login-card h1 {
        font-size: 26px;
        margin-bottom: 6px;
    }

    .subtitle {
        margin-bottom: 10px;
    }

    .divider {
        margin-bottom: 12px;
    }

    .divider span {
        width: 30px;
        height: 30px;
    }

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

    input.full {
        height: 50px;
    }

    button {
        height: 48px;
    }

    button.primary {
        margin-top: 10px;
    }

    .otp-group {
        margin-top: 10px;
    }

    .otp-digit {
        height: 48px;
    }

    .paste-otp {
        margin-top: 8px;
    }

    .resend-otp {
        margin-top: 4px;
        min-height: 30px;
    }

    .remember {
        margin: 4px 0 8px;
    }

    .message {
        margin-top: 8px;
    }

    .help {
        margin-top: 12px;
    }

    .footer {
        height: 40px;
    }
}

/* Installed app only: keep the header and footer clear of
   the camera cutout and the gesture bar. */
@media (display-mode: standalone) and (max-width: 900px) and (orientation: portrait) {
    .login-header {
        padding-top: env(safe-area-inset-top);
    }

    .footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
