.auth-container {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top right, #FFFFFF, #F3F1ED 55%, #E7E1DA 100%);
    padding: 32px;
    font-family: var(--font-body);
}

.auth-shell {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 32px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-elevated);
    padding: 32px;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
    padding: 12px 8px;
}

.auth-logo {
    width: 160px;
    height: auto;
    filter: brightness(0);
    opacity: 0.8;
}

.auth-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--color-dark);
    font-weight: 400;
}

.auth-subtitle {
    font-size: 1rem;
    color: var(--color-medium-3);
    line-height: 1.6;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.auth-photos {
    display: flex;
    gap: 14px;
    align-items: center;
}

/* Login: remove the individual team photos row */
.auth-photos {
    display: none !important;
}

.auth-photo {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(20, 20, 20, 0.08);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 100;
}

.auth-modal.active {
    display: flex;
}

.auth-modal-card {
    width: min(420px, 100%);
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-elevated);
}

.auth-modal-title {
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.95rem;
    color: var(--color-medium-3);
}

.auth-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.auth-modal-btn {
    padding: 10px 16px;
    border-radius: 12px;
    border: none;
    background: var(--color-dark);
    color: var(--color-white);
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.75rem;
    cursor: pointer;
}

.auth-modal-btn.secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-dark);
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-label {
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--color-medium-3);
    font-family: var(--font-heading);
    font-weight: 400;
}

.auth-input {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.9);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-quick);
}

.auth-input:focus {
    border-color: var(--color-border-strong);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.auth-error {
    min-height: 18px;
    color: #9A4B4B;
    font-size: 0.85rem;
}

.auth-card h2 {
    font-size: 1.1rem;
    color: var(--color-medium-3);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: var(--font-heading);
    font-weight: 400;
}

.role-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.role-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.7);
    transition: var(--transition-smooth);
}

.role-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-hover);
}

.role-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(20, 20, 20, 0.1);
}

.role-meta h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--color-dark);
    font-family: var(--font-heading);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.role-meta p {
    font-size: 0.85rem;
    color: var(--color-medium-2);
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.role-avatar-logo {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.9);
}

.role-avatar-boss {
    background: #1F1E1B;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-footer {
    font-size: 0.8rem;
    color: var(--color-medium-2);
    text-align: center;
}

/* Login: use the same STAFF photo on all devices (no layout changes) */
.role-card[data-role="staff"] .role-avatar {
    background-image: url('../assets/team/admin.jpg') !important;
    background-size: cover !important;
    background-position: center !important;
}

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

    .auth-brand {
        align-items: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 16px;
        min-height: 100vh;
    }

    .auth-shell {
        padding: 20px 16px;
        gap: 24px;
    }

    .auth-brand {
        gap: 16px;
        padding: 8px 0;
    }

    .auth-logo {
        width: 120px;
    }

    .auth-title {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }

    .auth-subtitle {
        font-size: 0.85rem;
        letter-spacing: 1px;
    }

    .auth-photos {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .auth-photo {
        width: 64px;
        height: 64px;
    }

    .auth-card {
        padding: 20px 16px;
        gap: 16px;
    }

    .auth-card h2 {
        font-size: 0.95rem;
    }

    .role-card {
        padding: 12px;
        gap: 12px;
    }

    .role-avatar {
        width: 56px;
        height: 56px;
    }

    .role-meta h3 {
        font-size: 0.9rem;
    }

    .role-meta p {
        font-size: 0.75rem;
    }

    .auth-modal-card {
        padding: 20px 16px;
        margin: 16px;
    }

    .auth-modal-title {
        font-size: 0.85rem;
    }

    .auth-input {
        font-size: 1rem;
        padding: 10px 12px;
    }

    .auth-modal-actions {
        flex-direction: column;
    }

    .auth-modal-btn {
        width: 100%;
    }
}

/* Phones (incl. Android): apply the iPhone-portrait sizing up to 720px (no layout change, just ensures it fits). */
@media (max-width: 720px) and (pointer: coarse) {
    .auth-container {
        padding: 16px;
        min-height: 100vh;
    }

    .auth-shell {
        width: 100%;
        grid-template-columns: 1fr;
        padding: 20px 16px;
        gap: 24px;
    }

    .auth-brand {
        gap: 16px;
        padding: 8px 0;
        align-items: center;
        text-align: center;
    }

    .auth-logo { width: 120px; }
    .auth-title { font-size: 1.6rem; letter-spacing: 2px; }
    .auth-subtitle { font-size: 0.85rem; letter-spacing: 1px; }

    .auth-card { padding: 20px 16px; gap: 16px; }
    .auth-card h2 { font-size: 0.95rem; }

    .role-card { padding: 12px; gap: 12px; }
    .role-avatar { width: 56px; height: 56px; }
    .role-meta h3 { font-size: 0.9rem; }
    .role-meta p { font-size: 0.75rem; }

    .auth-modal-card { padding: 20px 16px; margin: 16px; }
    .auth-modal-title { font-size: 0.85rem; }
    .auth-input { font-size: 1rem; padding: 10px 12px; }
    .auth-modal-actions { flex-direction: column; }
    .auth-modal-btn { width: 100%; }
}

/* Phone LANDSCAPE: shrink further so everything fits the short height. */
@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
    .auth-container {
        padding: 10px;
        min-height: 100dvh;
        align-items: start;
    }

    .auth-shell {
        width: 100%;
        padding: 14px 12px;
        gap: 12px;
        border-radius: 18px;
        /* Ensure we never exceed viewport height */
        max-height: calc(100dvh - 20px);
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .auth-brand {
        gap: 10px;
        padding: 4px 0;
    }

    .auth-logo { width: 92px; }
    .auth-title { font-size: 1.25rem; letter-spacing: 1.6px; }
    .auth-subtitle { font-size: 0.72rem; letter-spacing: 0.9px; line-height: 1.35; }

    .auth-card { padding: 14px 12px; gap: 12px; }
    .auth-card h2 { font-size: 0.82rem; }

    .role-card { padding: 10px; gap: 10px; }
    .role-avatar { width: 48px; height: 48px; }
    .role-meta h3 { font-size: 0.82rem; }
    .role-meta p { font-size: 0.68rem; }

    .auth-footer { font-size: 0.72rem; }
}

/* iPad PORTRAIT ONLY: use iPhone portrait login template (do not affect iPhone). */
@media (orientation: portrait) and (min-width: 721px) and (max-width: 1024px) {
    .auth-container {
        padding: 16px;
        min-height: 100vh;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        padding: 20px 16px;
        gap: 24px;
    }

    .auth-brand {
        gap: 16px;
        padding: 8px 0;
        align-items: center;
        text-align: center;
    }

    .auth-logo {
        width: 120px;
    }

    .auth-title {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }

    .auth-subtitle {
        font-size: 0.85rem;
        letter-spacing: 1px;
    }

    .auth-photos {
        /* iPad portrait login: remove the three small avatar photos row */
        display: none;
    }

    .auth-photo {
        width: 64px;
        height: 64px;
    }

    .auth-card {
        padding: 20px 16px;
        gap: 16px;
    }

    .auth-card h2 {
        font-size: 0.95rem;
    }

    .role-card {
        padding: 12px;
        gap: 12px;
    }

    /* iPad portrait login: show Admin + Staff side-by-side */
    .role-options {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .role-avatar {
        width: 56px;
        height: 56px;
    }

    /* iPad portrait login: staff uses the "screenshot" photo (admin.jpg) */
    .role-card[data-role="staff"] .role-avatar {
        background-image: url('../assets/team/admin.jpg') !important;
        background-size: cover !important;
        background-position: center !important;
    }

    .role-meta h3 {
        font-size: 0.9rem;
    }

    .role-meta p {
        font-size: 0.75rem;
    }

    .auth-modal-card {
        padding: 20px 16px;
        margin: 16px;
    }

    .auth-modal-title {
        font-size: 0.85rem;
    }

    .auth-input {
        font-size: 1rem;
        padding: 10px 12px;
    }

    .auth-modal-actions {
        flex-direction: column;
    }

    .auth-modal-btn {
        width: 100%;
    }
}