/* Portal de Proveedores — pantallas de autenticación (login, registro, reset) */

.sp-auth-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    background: var(--sp-bg);
    box-sizing: border-box;
}

.sp-auth-card {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    box-shadow: 0 4px 24px 0 rgb(0 0 0 / .08);
    width: 100%;
    max-width: 420px;
    padding: clamp(1.25rem, 5vw, 2rem) clamp(1.1rem, 4vw, 2rem) 1.35rem;
}

.sp-auth-logo {
    text-align: center;
    margin-bottom: 1.25rem;
}

.sp-auth-logo__icon {
    font-size: 2.5rem;
    color: var(--sp-primary);
    display: block;
}

.sp-auth-logo__title {
    font-size: clamp(1.15rem, 4.5vw, 1.3rem);
    font-weight: 700;
    color: var(--sp-text);
    margin: .35rem 0 .1rem;
    line-height: 1.25;
}

.sp-auth-logo__subtitle {
    font-size: .85rem;
    color: var(--sp-muted);
}

.sp-form-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--sp-text);
    display: block;
    margin-bottom: .35rem;
}

.sp-form-control {
    width: 100%;
    padding: .7rem .85rem;
    min-height: 48px;
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    /* 16px+ evita zoom automático en iOS al enfocar */
    font-size: 1rem;
    background: var(--sp-bg);
    color: var(--sp-text);
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}

/* Contenedor contraseña + botón mostrar */
.sp-input-wrap {
    position: relative;
}

.sp-input-wrap .sp-form-control {
    padding-right: 3rem;
}

.sp-input-wrap__toggle {
    position: absolute;
    right: .35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--sp-muted);
    cursor: pointer;
    border-radius: var(--sp-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sp-input-wrap__toggle:focus-visible {
    outline: 2px solid var(--sp-primary);
    outline-offset: 1px;
    color: var(--sp-primary);
}

.sp-form-control:focus {
    outline: none;
    border-color: var(--sp-primary);
    box-shadow: 0 0 0 3px rgb(26 86 219 / .15);
    background: #fff;
}

.sp-form-group { margin-bottom: 1rem; }

/* Fila: persona de contacto + usuario de portal (solo lectura) */
.sp-form-row--contact-user {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem 1.25rem;
}

.sp-form-row--contact-user .sp-form-row__main {
    flex: 1 1 220px;
    min-width: 0;
}

.sp-form-row--contact-user .sp-form-row__side {
    flex: 1 1 160px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.sp-readonly-login__label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--sp-text);
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: 0;
}

.sp-readonly-login__value {
    min-height: 48px;
    padding: .7rem .85rem;
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    box-sizing: border-box;
    background: #f3f4f6;
    color: var(--sp-muted);
    font-size: 1rem;
    line-height: 1.25;
    display: flex;
    align-items: center;
    user-select: none;
    cursor: default;
    word-break: break-word;
}

@media (max-width: 520px) {
    .sp-form-row--contact-user .sp-form-row__side {
        flex: 1 1 100%;
    }
}

.sp-auth-divider {
    text-align: center;
    color: var(--sp-muted);
    font-size: .8rem;
    margin: 1rem 0;
    position: relative;
}
.sp-auth-divider::before,
.sp-auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: var(--sp-border);
}
.sp-auth-divider::before { left: 0; }
.sp-auth-divider::after  { right: 0; }

.sp-auth-footer {
    text-align: center;
    font-size: .82rem;
    color: var(--sp-muted);
    margin-top: 1.25rem;
}
.sp-auth-footer a {
    color: var(--sp-primary);
    text-decoration: none;
}
.sp-auth-footer a:hover { text-decoration: underline; }

/* Indicador de fuerza de contraseña */
.sp-pwd-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: .35rem;
    transition: background .2s, width .2s;
    background: var(--sp-border);
}
.sp-pwd-strength[data-level="1"] { background: #ef4444; width: 33%; }
.sp-pwd-strength[data-level="2"] { background: #f59e0b; width: 66%; }
.sp-pwd-strength[data-level="3"] { background: #10b981; width: 100%; }

/* Formulario ancho (paso datos de contacto) */
.sp-auth-card--wide {
    max-width: 520px;
}

.sp-auth-hint {
    font-size: .85rem;
    color: var(--sp-muted);
    margin-bottom: 1rem;
    line-height: 1.45;
}

.sp-form-hint {
    display: block;
    font-size: .74rem;
    color: var(--sp-muted);
    margin-top: .25rem;
}

.sp-req {
    color: #b42318;
    font-weight: 700;
}

.sp-form-check {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    margin-bottom: .9rem;
    font-size: .88rem;
    line-height: 1.4;
    color: var(--sp-text);
}

.sp-form-check input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: .15rem;
    flex-shrink: 0;
    accent-color: var(--sp-primary);
    cursor: pointer;
}

.sp-form-check label {
    cursor: pointer;
}
