/* ============================================================================
   UNIFIED ACCOUNT ACCESS
   Presentation-only companion to /signinandsignout/access.php.
   ============================================================================ */

:root {
    --auth-vvh: 100dvh;
    --auth-purple: #6D64C6;
    --auth-purple-hover: #5D54B8;
    --auth-purple-soft: #F8F7FE;
    --auth-purple-line: #D9D5F3;
    --auth-purple-ink: #514A9B;
    --auth-canvas: #F7F9FC;
    --auth-surface: #FFFFFF;
    --auth-surface-soft: #FAFBFC;
    --auth-border: #E1E6ED;
    --auth-border-soft: #EBEEF3;
    --auth-text: #26354A;
    --auth-text-strong: #182337;
    --auth-muted: #6F7E93;
    --auth-faint: #8B98AA;
    --auth-danger: #B42318;
    --auth-danger-soft: #FEF3F2;
    --auth-danger-line: #FECDCA;
    --auth-success: #267A55;
    --auth-success-soft: #F2FBF6;
    --auth-success-line: #CDEBDD;
    --auth-radius: 20px;
    --auth-radius-small: 11px;
    --auth-shadow: 0 -18px 52px rgba(25, 35, 55, .16);
}

html,
body.auth-access-page {
    min-height: 100%;
    margin: 0;
}

body.auth-access-page {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background: #EEF1F7;
    color: var(--auth-text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.auth-access-page *,
.auth-access-page *::before,
.auth-access-page *::after {
    box-sizing: border-box;
}

.auth-access-canvas {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(241, 243, 248, .94)),
        #EEF1F7;
    pointer-events: none;
}

.auth-access-canvas::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .36;
    background-image:
        linear-gradient(rgba(109, 100, 198, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(109, 100, 198, .045) 1px, transparent 1px);
    background-size: 30px 30px;
    mask-image: linear-gradient(to bottom, #000, transparent 74%);
}

.auth-access-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(8px);
}

.auth-access-orb-one {
    top: -16vw;
    left: -10vw;
    width: 42vw;
    height: 42vw;
    background: rgba(109, 100, 198, .12);
}

.auth-access-orb-two {
    right: -12vw;
    bottom: -20vw;
    width: 48vw;
    height: 48vw;
    background: rgba(109, 100, 198, .08);
}

.auth-access-layer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: var(--auth-vvh);
    overflow: hidden;
}

.auth-access-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(31, 38, 53, .18);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.auth-access-sheet {
    --auth-sheet-width: 560px;
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    width: min(var(--auth-sheet-width), calc(100vw - 32px));
    max-height: min(92vh, calc(var(--auth-vvh) - 18px));
    overflow: hidden;
    border: 1px solid var(--auth-purple-line);
    border-top-width: 3px;
    border-bottom: 0;
    border-radius: var(--auth-radius) var(--auth-radius) 0 0;
    outline: none;
    background: var(--auth-canvas);
    box-shadow: var(--auth-shadow);
    transform: translateY(28px);
    opacity: 0;
    animation: authAccessSheetIn .22s cubic-bezier(.22, .8, .36, 1) forwards;
}

.auth-access-layer.is-swap .auth-access-sheet {
    transform: none;
    opacity: 1;
    animation: none;
}

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

.auth-access-header {
    position: relative;
    z-index: 2;
    padding: 15px 18px 0;
    border-bottom: 1px solid var(--auth-border);
    background: linear-gradient(98deg, var(--auth-purple-soft) 0%, #FFF 48%, #FFF 100%);
}

.auth-access-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    margin-bottom: 10px;
}

.auth-access-logo,
.auth-access-brandmark {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
}

.auth-access-logo {
    display: block;
    object-fit: contain;
}

.auth-access-brandmark {
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--auth-purple);
    color: #FFF;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 5px 14px rgba(81, 74, 155, .18);
}

.auth-access-brandname {
    min-width: 0;
    overflow: hidden;
    color: var(--auth-text-strong);
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-access-headrow {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-height: 80px;
}

.auth-access-context-icon,
.auth-access-back {
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border: 1px solid var(--auth-purple-line);
    border-radius: var(--auth-radius-small);
    background: var(--auth-purple-soft);
    color: var(--auth-purple);
    font-size: 18px;
    text-decoration: none;
}

.auth-access-back {
    border-color: var(--auth-border);
    background: rgba(255, 255, 255, .84);
    color: #5C6A7E;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.auth-access-back:hover,
.auth-access-back:focus-visible {
    border-color: var(--auth-purple-line);
    outline: none;
    background: var(--auth-purple-soft);
    color: var(--auth-purple-ink);
}

.auth-access-heading {
    min-width: 0;
    padding-top: 1px;
}

.auth-access-kicker {
    color: var(--auth-purple-ink);
    font-size: 9.5px;
    font-weight: 650;
    letter-spacing: .06em;
    line-height: 1.2;
}

.auth-access-title {
    margin: 5px 0 0;
    color: var(--auth-text-strong);
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -.015em;
    line-height: 1.25;
}

.auth-access-subtitle {
    max-width: 430px;
    margin: 4px 0 0;
    color: var(--auth-muted);
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.4;
}

.auth-access-tabs {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    min-height: 43px;
    margin-top: 1px;
}

.auth-access-tab {
    display: inline-flex;
    align-items: center;
    height: 43px;
    border-bottom: 2px solid transparent;
    color: #8793A5;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease;
}

.auth-access-tab:hover,
.auth-access-tab:focus-visible {
    outline: none;
    color: #5C697C;
}

.auth-access-tab.active {
    border-bottom-color: var(--auth-purple);
    color: var(--auth-purple-ink);
    font-weight: 650;
}

.auth-access-feedback {
    min-height: 0;
    padding: 0 18px;
    background: var(--auth-canvas);
}

.auth-access-feedback:empty {
    display: none;
}

.auth-access-feedback-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 11px 12px;
    border: 1px solid var(--auth-border);
    border-radius: 11px;
    background: #FFF;
    color: var(--auth-text);
    font-size: 11.5px;
    line-height: 1.4;
}

.auth-access-feedback-card > i {
    margin-top: 1px;
    font-size: 14px;
}

.auth-access-feedback-card > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.auth-access-feedback-card strong {
    color: inherit;
    font-size: 11.5px;
    font-weight: 650;
}

.auth-access-feedback-card span {
    overflow-wrap: anywhere;
}

.auth-access-feedback[data-state="error"] .auth-access-feedback-card {
    border-color: var(--auth-danger-line);
    background: var(--auth-danger-soft);
    color: var(--auth-danger);
}

.auth-access-feedback[data-state="success"] .auth-access-feedback-card {
    border-color: var(--auth-success-line);
    background: var(--auth-success-soft);
    color: var(--auth-success);
}

.auth-access-feedback[data-state="network"] .auth-access-feedback-card {
    border-color: #F4D6A6;
    background: #FFFAF0;
    color: #8A5B16;
}

.auth-access-body {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 15px 18px 24px;
    background: var(--auth-canvas);
    scrollbar-width: thin;
    scrollbar-color: #CBD2DC transparent;
}

.auth-access-form {
    display: grid;
    gap: 14px;
    padding: 17px 18px;
    border: 1px solid var(--auth-border-soft);
    border-radius: 14px;
    background: var(--auth-surface);
    box-shadow: 0 2px 8px rgba(35, 48, 71, .035);
}

.auth-access-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.auth-access-field label {
    color: #46556A;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
}

.auth-access-field input {
    width: 100%;
    min-width: 0;
    height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #D8DEE7;
    border-radius: 10px;
    outline: none;
    background: #FFF;
    color: var(--auth-text-strong);
    font: inherit;
    font-size: 13px;
    line-height: 1;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.auth-access-field input:hover {
    border-color: #C8CFDA;
}

.auth-access-field input:focus {
    border-color: var(--auth-purple);
    box-shadow: 0 0 0 3px rgba(109, 100, 198, .12);
}

.auth-access-field input:user-invalid {
    border-color: #D92D20;
}

.auth-access-password {
    position: relative;
}

.auth-access-password input {
    padding-right: 48px;
}

.auth-access-reveal {
    position: absolute;
    top: 50%;
    right: 4px;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    transform: translateY(-50%);
    place-items: center;
    border: 0;
    border-radius: 8px;
    outline: none;
    background: transparent;
    color: var(--auth-muted);
    font-size: 15px;
    cursor: pointer;
}

.auth-access-reveal:hover,
.auth-access-reveal:focus-visible {
    background: var(--auth-purple-soft);
    color: var(--auth-purple-ink);
}

.auth-access-help {
    margin: 0;
    color: var(--auth-muted);
    font-size: 10.5px;
    line-height: 1.45;
}

.auth-access-inline-actions {
    display: flex;
    justify-content: flex-end;
    min-height: 20px;
    margin-top: -4px;
}

.auth-access-inline-actions a {
    color: var(--auth-purple-ink);
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
}

.auth-access-inline-actions a:hover,
.auth-access-inline-actions a:focus-visible {
    outline: none;
    text-decoration: underline;
}

.auth-access-account-summary {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px;
    border: 1px solid var(--auth-purple-line);
    border-radius: 11px;
    background: var(--auth-purple-soft);
}

.auth-access-summary-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border-radius: 10px;
    background: #FFF;
    color: var(--auth-purple);
    font-size: 17px;
}

.auth-access-account-summary > div {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.auth-access-account-summary strong,
.auth-access-account-summary span,
.auth-access-account-summary small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-access-account-summary strong {
    color: var(--auth-text-strong);
    font-size: 12px;
    font-weight: 650;
}

.auth-access-account-summary span,
.auth-access-account-summary small {
    color: var(--auth-muted);
    font-size: 10.5px;
}

.auth-access-empty {
    display: grid;
    justify-items: center;
    padding: 30px 22px;
    border: 1px solid var(--auth-border-soft);
    border-radius: 14px;
    background: #FFF;
    text-align: center;
}

.auth-access-empty > span {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    place-items: center;
    border-radius: 14px;
    background: var(--auth-purple-soft);
    color: var(--auth-purple);
    font-size: 22px;
}

.auth-access-empty h2 {
    margin: 0;
    color: var(--auth-text-strong);
    font-size: 15px;
    font-weight: 650;
}

.auth-access-empty p {
    max-width: 390px;
    margin: 7px 0 0;
    color: var(--auth-muted);
    font-size: 11.5px;
    line-height: 1.45;
}

.auth-access-footer {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 68px;
    padding: 11px 18px calc(11px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--auth-border);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -6px 18px rgba(30, 42, 61, .045);
}

.auth-access-security {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--auth-faint);
    font-size: 10.5px;
    white-space: nowrap;
}

.auth-access-security i {
    color: var(--auth-purple);
    font-size: 10px;
}

.auth-access-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 178px;
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid var(--auth-purple);
    border-radius: 11px;
    outline: none;
    background: var(--auth-purple);
    color: #FFF;
    font-family: inherit;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease, opacity .15s ease;
}

.auth-access-primary:hover,
.auth-access-primary:focus-visible {
    border-color: var(--auth-purple-hover);
    background: var(--auth-purple-hover);
    color: #FFF;
}

.auth-access-primary:active {
    transform: translateY(1px);
}

.auth-access-primary:disabled,
.auth-access-primary.is-loading {
    opacity: .72;
    cursor: wait;
}

.auth-access-primary .auth-access-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .44);
    border-top-color: #FFF;
    border-radius: 50%;
    animation: authAccessSpin .7s linear infinite;
}

@keyframes authAccessSpin {
    to { transform: rotate(360deg); }
}

.auth-access-noscript {
    position: fixed;
    z-index: 10001;
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: 540px;
    margin: auto;
    padding: 9px 12px;
    border: 1px solid #F4D6A6;
    border-radius: 9px;
    background: #FFFAF0;
    color: #8A5B16;
    font-size: 11px;
    text-align: center;
}

body.auth-access-loading .auth-access-sheet {
    cursor: progress;
}

body.auth-access-loading .auth-access-body,
body.auth-access-loading .auth-access-header {
    pointer-events: none;
}

@media (max-width: 640px) {
    .auth-access-sheet {
        width: calc(100vw - 12px);
        max-height: calc(var(--auth-vvh) - 6px);
        border-radius: 18px 18px 0 0;
    }

    .auth-access-header {
        padding: 13px 12px 0;
    }

    .auth-access-brand {
        margin-bottom: 9px;
    }

    .auth-access-headrow {
        min-height: 76px;
        gap: 9px;
    }

    .auth-access-context-icon,
    .auth-access-back {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .auth-access-title {
        font-size: 17px;
    }

    .auth-access-subtitle {
        font-size: 10.5px;
    }

    .auth-access-tabs {
        gap: 22px;
        min-height: 42px;
    }

    .auth-access-tab {
        height: 42px;
    }

    .auth-access-feedback {
        padding: 0 10px;
    }

    .auth-access-feedback-card {
        margin-top: 10px;
    }

    .auth-access-body {
        padding: 10px 10px 16px;
    }

    .auth-access-form {
        gap: 13px;
        padding: 15px 13px;
        border-radius: 12px;
    }

    .auth-access-footer {
        min-height: 66px;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    }

    .auth-access-primary {
        min-width: 166px;
        min-height: 44px;
    }
}

/* Desktop/tablet: the access surface is a centred modal. Mobile remains the
   familiar bottom sheet so it continues to work naturally with the keyboard. */
@media (min-width: 641px) {
    .auth-access-layer {
        align-items: center;
        padding: 24px;
    }

    .auth-access-sheet {
        max-height: min(86vh, calc(var(--auth-vvh) - 48px));
        border-bottom: 1px solid var(--auth-purple-line);
        border-radius: var(--auth-radius);
        box-shadow: 0 20px 56px rgba(25, 35, 55, .18);
    }
}

@media (max-width: 390px) {
    .auth-access-security span {
        display: none;
    }

    .auth-access-primary {
        flex: 1 1 auto;
        min-width: 0;
    }

    .auth-access-brandname {
        max-width: 250px;
    }
}

@media (max-height: 620px) {
    .auth-access-brand {
        margin-bottom: 5px;
    }

    .auth-access-headrow {
        min-height: 64px;
    }

    .auth-access-subtitle {
        display: none;
    }

    .auth-access-tabs,
    .auth-access-tab {
        min-height: 38px;
        height: 38px;
    }

    .auth-access-body {
        padding-top: 9px;
        padding-bottom: 12px;
    }

    .auth-access-footer {
        min-height: 58px;
        padding-top: 7px;
        padding-bottom: calc(7px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-access-sheet,
    .auth-access-primary,
    .auth-access-tab,
    .auth-access-field input,
    .auth-access-back {
        animation: none !important;
        transition: none !important;
    }

    .auth-access-sheet {
        transform: none;
        opacity: 1;
    }
}
